Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47026 invoked from network); 24 May 2012 15:24:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2012 15:24:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=tom@punkave.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tom@punkave.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain punkave.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: tom@punkave.com X-Host-Fingerprint: 209.85.161.170 mail-gg0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:55937] helo=mail-gg0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/99-31936-8A25EBF4 for ; Thu, 24 May 2012 11:24:25 -0400 Received: by ggnf2 with SMTP id f2so8775428ggn.29 for ; Thu, 24 May 2012 08:24:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding:x-gm-message-state; bh=Rlo6rackn48yI3kKuaptd6Y1mYicDcbZ/prWmsKFcmI=; b=cLdAKhm2AOXmsx9oIOVdFWD1pdCHYVhk6CWx/S+d8xuHfh8SqTAfBJ20xoYzKHOLUQ bL7QWOP5lAGVsaj7uQtBL7mnNIxuYvG0nnt2hpjbbWqGZfEMh/8kCikHanCHM5S++sou f4VsYVTXnlXvuc8K8UKuy7THH7N2IgCM9DsFTCIgoM6AaU7ykZHdvnLlD8e6H7VqXD0D YSsTtGcnSZrHWSJteJCG/A8ANGa8WiGKarkLfEcF9wtbYH1Smr9egqdCmV7CDrCIpbu7 hRjwlweVKi3xkRajCI53mRQlOLlEacGc8cjFFi9/6Up6A9Wye0UJkZP2ne+YOEckrTAh 5MAA== MIME-Version: 1.0 Received: by 10.236.75.40 with SMTP id y28mr36040317yhd.65.1337873057529; Thu, 24 May 2012 08:24:17 -0700 (PDT) Received: by 10.100.109.13 with HTTP; Thu, 24 May 2012 08:24:17 -0700 (PDT) In-Reply-To: References: <55e590f078f22ca2bbe10d5187cd3d84.squirrel@www.l-i-e.com> Date: Thu, 24 May 2012 11:24:17 -0400 Message-ID: To: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmLjpQSeaGp3JUeRZFvwZeNTyGhsaBZKqQWrjCheTPEw7JOmopARg2yzhOJSu+8/HSOTYdu Subject: Re: [PHP-DEV] php interpreter From: tom@punkave.com (Tom Boutell) (I'm not questioning that APC makes an enormous difference. That's painfully obvious from 100 miles away on our servers (: ) On Thu, May 24, 2012 at 11:23 AM, Tom Boutell wrote: > I've seen this statement before about the impact of caching the actual > compilation (or mere tokenization?) to bytecode being very small > compared to the impact of avoiding disk access. I am curious if there > are any measurements breaking this down. Read-only access to code in > files already buffered by the OS (not files read for the first time) > ought to be very fast. > > On Tue, May 22, 2012 at 11:00 AM, Richard Lynch wrote: >> On Wed, May 9, 2012 5:05 pm, Xin Tong wrote: >> >>> 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 ? >> >> I believe the interpreter is built out of bison/yacc files, so you >> could start with those to find out where they put it. >> >> The php runtime is a JIT parser/compiler to a bytecode, which is then >> run by the Zend Engine (see above). >> >> Actually, that last statement might imply the the zend directory would >> also be a good place to look. >> >> Finally, it should be noted that APC and other caching mechanisms save >> a great deal of time by not hitting the disk to load the script, but >> keeping it in RAM, if possible. >> >> As "gravy" on top of that, the bytecode is saved in cache instead of >> source, so it is not a JIT if one of those caches is in use. >> >> Psuedo code to describe the difference the APC (or other cache) makes: >> >> >> //save hitting the hard disk >> if ( $source_code =3D in_cache($path)){ >> } >> else{ >> =A0//super-duper slow!!! >> =A0$source_code =3D file_get_contents($path); >> } >> $bytecode =3D zend_parse($source_code); >> zend_execute($bytecode); >> >> //save hitting the hard disk >> //and a small bonus, cache the bytecode, not source: >> >> if ($bytecode =3D in_cache($path)){ >> =A0//do nothing >> } >> else{ >> =A0$source_code =3D file_get_contents($path); >> =A0$bytecode =3D zend_parse($source_code); >> } >> zend_execute($bytecode); >> >> >> The savings from parsing is chump change compared to disk I/O. >> >> It's also trivial chump change to implement. >> >> Ever ounce counts :-) >> >> -- >> brain cancer update: >> http://richardlynch.blogspot.com/search/label/brain%20tumor >> Donate: >> https://www.paypal.com/cgi-bin/webscr?cmd=3D_s-xclick&hosted_button_id= =3DFS9NLTNEEKWBE >> >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > > -- > Tom Boutell > P'unk Avenue > 215 755 1330 > punkave.com > window.punkave.com --=20 Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com