Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64124 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26726 invoked from network); 30 Nov 2012 22:22:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2012 22:22:54 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.210.173 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.210.173 mail-ia0-f173.google.com Received: from [209.85.210.173] ([209.85.210.173:42207] helo=mail-ia0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/00-26487-CB139B05 for ; Fri, 30 Nov 2012 17:22:53 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so982253iac.18 for ; Fri, 30 Nov 2012 14:22:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=LbntoaztvDFpXRt7iYB/gz0/mzdf1yqv59zVMyd8E2E=; b=GXH5VHvkG+00MKEVkOGxegOQialCDKLdZK9uVdUgiqTcD/luRSQWXj6Gbmjf4E7+Ve /ezBkA+lKWWCuwm3UCX60MaRGfwxmCP5nK1p9KNMhKqRZ8bUaskyQXIKuOhdwco+k7hc ATLI7r7SsjqGUkoBU4HmfaNStm3Bs7tN8C3yldW4MR8unWH3PBBeY7dv8huigw+HDeuv f0v3WXTU9wfLosRtqRm18Zbzwo/t09CJId0FRyL/lLrEOCha52+Wgw96tNG2yHL2zzFP IQa4QSjdrbTjbR1MY53+2+n+sxlF2iu0Oc82wpNDtE5pVwjDSjI1ieVMm3HUQcnTxztf 5Bng== MIME-Version: 1.0 Received: by 10.43.125.133 with SMTP id gs5mr2233229icc.54.1354314169472; Fri, 30 Nov 2012 14:22:49 -0800 (PST) Sender: php@golemon.com Received: by 10.64.21.193 with HTTP; Fri, 30 Nov 2012 14:22:49 -0800 (PST) X-Originating-IP: [2620:0:1cfe:b:f903:7f7a:fa66:ea3d] In-Reply-To: References: <50B41783.90104@lerdorf.com> <50B44AFE.5030307@lerdorf.com> Date: Fri, 30 Nov 2012 14:22:49 -0800 X-Google-Sender-Auth: lppKjZ-CEzVNirU10mEhYYZaMrM Message-ID: To: Raymond Irving Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnny4UBX9IcQOAk9zK3Fu7cAB55mL8KBwlyiAb3uQ6gHULDeL/XBkTejC7tvJLtdGfDmW9W Subject: Re: [PHP-DEV] HHVM and PHP From: pollita@php.net (Sara Golemon) If you're so inclined to pursue it, you don't (technically) need to modify PHP core at all. 1) Make an extension which hooks zend_compile_file (just as APC and many others do). 2) First request of a file passes through to the real compiler and both returns main() opcodes *and* sends a copy of main() (and any new classes/functions) to JITter. 3) Subsequent requests get ZEND_INTERNAL_(FUNCTION|CLASS) stubs created for calling JIT code 4) RSHUTDOWN method explicitly cleans up ZEND_USER_(FUNCTION|CLASSe)s and JIT-stub ZEND_INTERNAL_(FUNCTION|CLASSe)s since the default sweep will get confused by the staggered function/class types. Only hard part in there is the JIT itself, but that was never going to be simple. :) On Fri, Nov 30, 2012 at 7:04 AM, Raymond Irving wrote: > Many thanks for the feedback. > > I would love see some JIT features added to the core as this would help to > improve the overall performance. > > Sara, > > I like your extension idea as this would not require any changes to the > core. > > Here's another idea: > ----------------------------------- > 1. Modify PHP core to cache opcodes on first request > 2. Create external program (or library) that can be scheduled to compile > cached opcodes to native code when necessary. This can be scheduled as a > cron job > 3. PHP will then run either the cached opcodes or the compiles codes when > the page is request a second time. > > In this solution you get bets of both worlds. PHP can execute opcode cache > or native code if it's available. There would be no need for the core to > further compile or optimize the opcodes as the external program will perform > these operations. The end result is that the application performance will > improve with usage and time. > > What do you think? > > __ > Raymond > > > On Tue, Nov 27, 2012 at 2:37 AM, Sara Golemon wrote: >> >> On Mon, Nov 26, 2012 at 9:09 PM, Rasmus Lerdorf >> wrote: >> > On 11/26/2012 09:03 PM, Sara Golemon wrote: >> >> P.S. - I do disagree with Rasmus' statement about none of us looking >> >> at fitting a JIT into PHP. ;) >> > >> > I think you misread my reply. I specifically said that a JIT is a >> > possibility, just not the HH approach. >> > >> No no, I caught that. I was just being pedantic in that I *am* >> looking at fitting a few JIT approaches into PHP (via extensions), >> including one based on HipHop's approach. :p But if we're still being >> pedantic, then I should admit to not working too hard on that front. >> >> -Sara > >