<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP-DEV] php interpreter</title>
        <description> Hello

I am new to php runtime. i am doing some research on runtime
interpreter. can anyone please tell me where the interpreter of the
php runtime is ? which file ? and does the php runtime has a JIT
compiler ?

Thanks

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php</description>
        <link>http://www.serverphorums.com/read.php?7,493309,493309#msg-493309</link>
        <lastBuildDate>Tue, 21 May 2013 05:40:51 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,506220#msg-506220</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,506220#msg-506220</link>
            <description><![CDATA[ Hi!<br />
<br />
&gt; I've seen this statement before about the impact of caching the actual<br />
&gt; compilation (or mere tokenization?) to bytecode being very small<br />
&gt; compared to the impact of avoiding disk access. I am curious if there<br />
&gt; are any measurements breaking this down. Read-only access to code in<br />
&gt; files already buffered by the OS (not files read for the first time)<br />
&gt; ought to be very fast.<br />
<br />
We did some measurements a long time ago at Zend, but I don't have the<br />
numbers right now and anyway the engine changed so much since then they<br />
are probably irrelevant anyway. However, the main gist is right - time<br />
saved on compilation is not that much. One of the reasons to that is<br />
that some of the data structures that are used by the engine are dynamic<br />
(class tables, class variables, static variables, etc.) which means a<br />
lot of data needs still to be handled to make script stored in SHM<br />
runnable. Which greatly decreases savings from not compiling it. The<br />
disk read however is still saved, and since unlike compilation it's a<br />
system call and talks to potentially very slow (compared to memory)<br />
device, the savings are significant. Even with OS cache, you still have<br />
context switches and copying the data, etc. With some work I think it is<br />
possible to make PHP script to run with zero system calls spent on<br />
loading script files.<br />
-- <br />
Stanislav Malyshev, Software Architect<br />
SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
(408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Stas Malyshev</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 01 Jun 2012 08:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,502484#msg-502484</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,502484#msg-502484</link>
            <description><![CDATA[ On 05/24/2012 08:23 AM, Tom Boutell wrote:<br />
&gt; I've seen this statement before about the impact of caching the actual<br />
&gt; compilation (or mere tokenization?) to bytecode being very small<br />
&gt; compared to the impact of avoiding disk access. I am curious if there<br />
&gt; are any measurements breaking this down. Read-only access to code in<br />
&gt; files already buffered by the OS (not files read for the first time)<br />
&gt; ought to be very fast.<br />
<br />
I don't think anyone has any hard numbers on what percentage is gained<br />
from each of the optimizations that APC brings. There are actually 3<br />
separate areas, not 2. The obvious skip-compile and skip-disk-read, but<br />
also the fact that non-conditional functions and classes are cached and<br />
the compiled op arrays modified to NOP out the DECLARE_FUNCTION and<br />
DECLARE_CLASS opcodes.<br />
<br />
The percentage gains are going to different depending on the<br />
characteristics of your code. If you have thousands of functions and<br />
classes but your code is relatively compact, then the function/class<br />
caching might be more significant.<br />
<br />
-Rasmus<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Rasmus Lerdorf</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 24 May 2012 18:20:04 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,502441#msg-502441</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,502441#msg-502441</link>
            <description><![CDATA[ (I'm not questioning that APC makes an enormous difference. That's<br />
painfully obvious from 100 miles away on our servers (: )<br />
<br />
On Thu, May 24, 2012 at 11:23 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
&gt; I've seen this statement before about the impact of caching the actual<br />
&gt; compilation (or mere tokenization?) to bytecode being very small<br />
&gt; compared to the impact of avoiding disk access. I am curious if there<br />
&gt; are any measurements breaking this down. Read-only access to code in<br />
&gt; files already buffered by the OS (not files read for the first time)<br />
&gt; ought to be very fast.<br />
&gt;<br />
&gt; On Tue, May 22, 2012 at 11:00 AM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt;&gt; On Wed, May 9, 2012 5:05 pm, Xin Tong wrote:<br />
&gt;&gt;<br />
&gt;&gt;&gt; I am new to php runtime. i am doing some research on runtime<br />
&gt;&gt;&gt; interpreter. can anyone please tell me where the interpreter of the<br />
&gt;&gt;&gt; php runtime is ? which file ? and does the php runtime has a JIT<br />
&gt;&gt;&gt; compiler ?<br />
&gt;&gt;<br />
&gt;&gt; I believe the interpreter is built out of bison/yacc files, so you<br />
&gt;&gt; could start with those to find out where they put it.<br />
&gt;&gt;<br />
&gt;&gt; The php runtime is a JIT parser/compiler to a bytecode, which is then<br />
&gt;&gt; run by the Zend Engine (see above).<br />
&gt;&gt;<br />
&gt;&gt; Actually, that last statement might imply the the zend directory would<br />
&gt;&gt; also be a good place to look.<br />
&gt;&gt;<br />
&gt;&gt; Finally, it should be noted that APC and other caching mechanisms save<br />
&gt;&gt; a great deal of time by not hitting the disk to load the script, but<br />
&gt;&gt; keeping it in RAM, if possible.<br />
&gt;&gt;<br />
&gt;&gt; As &quot;gravy&quot; on top of that, the bytecode is saved in cache instead of<br />
&gt;&gt; source, so it is not a JIT if one of those caches is in use.<br />
&gt;&gt;<br />
&gt;&gt; Psuedo code to describe the difference the APC (or other cache) makes:<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; //save hitting the hard disk<br />
&gt;&gt; if ( $source_code = in_cache($path)){<br />
&gt;&gt; }<br />
&gt;&gt; else{<br />
&gt;&gt;  //super-duper slow!!!<br />
&gt;&gt;  $source_code = file_get_contents($path);<br />
&gt;&gt; }<br />
&gt;&gt; $bytecode = zend_parse($source_code);<br />
&gt;&gt; zend_execute($bytecode);<br />
&gt;&gt;<br />
&gt;&gt; //save hitting the hard disk<br />
&gt;&gt; //and a small bonus, cache the bytecode, not source:<br />
&gt;&gt;<br />
&gt;&gt; if ($bytecode = in_cache($path)){<br />
&gt;&gt;  //do nothing<br />
&gt;&gt; }<br />
&gt;&gt; else{<br />
&gt;&gt;  $source_code = file_get_contents($path);<br />
&gt;&gt;  $bytecode = zend_parse($source_code);<br />
&gt;&gt; }<br />
&gt;&gt; zend_execute($bytecode);<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; The savings from parsing is chump change compared to disk I/O.<br />
&gt;&gt;<br />
&gt;&gt; It's also trivial chump change to implement.<br />
&gt;&gt;<br />
&gt;&gt; Ever ounce counts :-)<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; brain cancer update:<br />
&gt;&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt;&gt; Donate:<br />
&gt;&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; Tom Boutell<br />
&gt; P'unk Avenue<br />
&gt; 215 755 1330<br />
&gt; punkave.com<br />
&gt; window.punkave.com<br />
<br />
<br />
<br />
-- <br />
Tom Boutell<br />
P'unk Avenue<br />
215 755 1330<br />
punkave.com<br />
window.punkave.com<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Tom Boutell</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 24 May 2012 17:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,502440#msg-502440</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,502440#msg-502440</link>
            <description><![CDATA[ I've seen this statement before about the impact of caching the actual<br />
compilation (or mere tokenization?) to bytecode being very small<br />
compared to the impact of avoiding disk access. I am curious if there<br />
are any measurements breaking this down. Read-only access to code in<br />
files already buffered by the OS (not files read for the first time)<br />
ought to be very fast.<br />
<br />
On Tue, May 22, 2012 at 11:00 AM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt; On Wed, May 9, 2012 5:05 pm, Xin Tong wrote:<br />
&gt;<br />
&gt;&gt; I am new to php runtime. i am doing some research on runtime<br />
&gt;&gt; interpreter. can anyone please tell me where the interpreter of the<br />
&gt;&gt; php runtime is ? which file ? and does the php runtime has a JIT<br />
&gt;&gt; compiler ?<br />
&gt;<br />
&gt; I believe the interpreter is built out of bison/yacc files, so you<br />
&gt; could start with those to find out where they put it.<br />
&gt;<br />
&gt; The php runtime is a JIT parser/compiler to a bytecode, which is then<br />
&gt; run by the Zend Engine (see above).<br />
&gt;<br />
&gt; Actually, that last statement might imply the the zend directory would<br />
&gt; also be a good place to look.<br />
&gt;<br />
&gt; Finally, it should be noted that APC and other caching mechanisms save<br />
&gt; a great deal of time by not hitting the disk to load the script, but<br />
&gt; keeping it in RAM, if possible.<br />
&gt;<br />
&gt; As &quot;gravy&quot; on top of that, the bytecode is saved in cache instead of<br />
&gt; source, so it is not a JIT if one of those caches is in use.<br />
&gt;<br />
&gt; Psuedo code to describe the difference the APC (or other cache) makes:<br />
&gt;<br />
&gt;<br />
&gt; //save hitting the hard disk<br />
&gt; if ( $source_code = in_cache($path)){<br />
&gt; }<br />
&gt; else{<br />
&gt;  //super-duper slow!!!<br />
&gt;  $source_code = file_get_contents($path);<br />
&gt; }<br />
&gt; $bytecode = zend_parse($source_code);<br />
&gt; zend_execute($bytecode);<br />
&gt;<br />
&gt; //save hitting the hard disk<br />
&gt; //and a small bonus, cache the bytecode, not source:<br />
&gt;<br />
&gt; if ($bytecode = in_cache($path)){<br />
&gt;  //do nothing<br />
&gt; }<br />
&gt; else{<br />
&gt;  $source_code = file_get_contents($path);<br />
&gt;  $bytecode = zend_parse($source_code);<br />
&gt; }<br />
&gt; zend_execute($bytecode);<br />
&gt;<br />
&gt;<br />
&gt; The savings from parsing is chump change compared to disk I/O.<br />
&gt;<br />
&gt; It's also trivial chump change to implement.<br />
&gt;<br />
&gt; Ever ounce counts :-)<br />
&gt;<br />
&gt; --<br />
&gt; brain cancer update:<br />
&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt; Donate:<br />
&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
<br />
<br />
<br />
-- <br />
Tom Boutell<br />
P'unk Avenue<br />
215 755 1330<br />
punkave.com<br />
window.punkave.com<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Tom Boutell</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 24 May 2012 17:30:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,501312#msg-501312</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,501312#msg-501312</link>
            <description><![CDATA[ Hi!<br />
<br />
&gt;&gt; I am new to php runtime. i am doing some research on runtime<br />
&gt;&gt; interpreter. can anyone please tell me where the interpreter of the<br />
&gt;&gt; php runtime is ? which file ? and does the php runtime has a JIT<br />
&gt;&gt; compiler ?<br />
<br />
PHP compiles source code into Zend Engine bytecode - this is done by the<br />
compiler in zend_language_scanner.l, zend_language_parser.y and<br />
zend_compile.c. This code is the executed by the opcode engine in<br />
zend_execute.c and zend_vm_execute.h. The latter is generated from<br />
zend_vm_def.h by means of the script zend_vm_gen.php.<br />
<br />
-- <br />
Stanislav Malyshev, Software Architect<br />
SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
(408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Stas Malyshev</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 23 May 2012 04:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,500922#msg-500922</guid>
            <title>Re: [PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,500922#msg-500922</link>
            <description><![CDATA[ On Wed, May 9, 2012 5:05 pm, Xin Tong wrote:<br />
<br />
&gt; I am new to php runtime. i am doing some research on runtime<br />
&gt; interpreter. can anyone please tell me where the interpreter of the<br />
&gt; php runtime is ? which file ? and does the php runtime has a JIT<br />
&gt; compiler ?<br />
<br />
I believe the interpreter is built out of bison/yacc files, so you<br />
could start with those to find out where they put it.<br />
<br />
The php runtime is a JIT parser/compiler to a bytecode, which is then<br />
run by the Zend Engine (see above).<br />
<br />
Actually, that last statement might imply the the zend directory would<br />
also be a good place to look.<br />
<br />
Finally, it should be noted that APC and other caching mechanisms save<br />
a great deal of time by not hitting the disk to load the script, but<br />
keeping it in RAM, if possible.<br />
<br />
As &quot;gravy&quot; on top of that, the bytecode is saved in cache instead of<br />
source, so it is not a JIT if one of those caches is in use.<br />
<br />
Psuedo code to describe the difference the APC (or other cache) makes:<br />
<br />
<br />
//save hitting the hard disk<br />
if ( $source_code = in_cache($path)){<br />
}<br />
else{<br />
  //super-duper slow!!!<br />
  $source_code = file_get_contents($path);<br />
}<br />
$bytecode = zend_parse($source_code);<br />
zend_execute($bytecode);<br />
<br />
//save hitting the hard disk<br />
//and a small bonus, cache the bytecode, not source:<br />
<br />
if ($bytecode = in_cache($path)){<br />
  //do nothing<br />
}<br />
else{<br />
  $source_code = file_get_contents($path);<br />
  $bytecode = zend_parse($source_code);<br />
}<br />
zend_execute($bytecode);<br />
<br />
<br />
The savings from parsing is chump change compared to disk I/O.<br />
<br />
It's also trivial chump change to implement.<br />
<br />
Ever ounce counts :-)<br />
<br />
-- <br />
brain cancer update:<br />
<a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
Donate:<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Richard Lynch</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 22 May 2012 17:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,493309,493309#msg-493309</guid>
            <title>[PHP-DEV] php interpreter</title>
            <link>http://www.serverphorums.com/read.php?7,493309,493309#msg-493309</link>
            <description><![CDATA[ Hello<br />
<br />
I am new to php runtime. i am doing some research on runtime<br />
interpreter. can anyone please tell me where the interpreter of the<br />
php runtime is ? which file ? and does the php runtime has a JIT<br />
compiler ?<br />
<br />
Thanks<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Xin Tong</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 10 May 2012 00:10:02 +0200</pubDate>
        </item>
    </channel>
</rss>
