Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65544 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58142 invoked from network); 31 Jan 2013 18:10:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2013 18:10:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.177 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.177 mail-vc0-f177.google.com Received: from [209.85.220.177] ([209.85.220.177:65095] helo=mail-vc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/A3-25207-793BA015 for ; Thu, 31 Jan 2013 13:10:32 -0500 Received: by mail-vc0-f177.google.com with SMTP id m18so1915513vcm.8 for ; Thu, 31 Jan 2013 10:10:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=mE+zTkH6MLJkkKGzdPYGSQEZtZXA8w/cEMS/d8k67Ms=; b=Y4QJGNK9fZHBbbDzkpGyL5jwpKHhLZ+kRqlxOfElMwazLi6gEt+1ZHz1qzoyNoOtaj U4GIZtB+1uwHmyEXul5m8RKlQyfO9qJDnxWzW5hRdfVUMVMcF3fsl52yTb95q2K/1K/q lB0g0tqBIEuuSx6vVOsMsBmq+TkwtCEneibCcZjJ/JoKpWK6hs1G4XyknNHoyPFx8UgR Bk5sNRKnyTihHVzMc6zoazwjaYjEW+t6egX3XlPIQHRaTltJPtoxR6sPvwUYCF6ijm0C C23QegveesGaZWKVHyb169cdiFwN2/hyKT7Y/bmWBSyh+mgAcQ6UD+smJzi3aboK/H7g yGUQ== X-Received: by 10.220.238.139 with SMTP id ks11mr8691728vcb.49.1359655828921; Thu, 31 Jan 2013 10:10:28 -0800 (PST) Received: from [192.168.200.148] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id g5sm5322597vez.6.2013.01.31.10.10.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jan 2013 10:10:28 -0800 (PST) Message-ID: <510AB391.7020403@lerdorf.com> Date: Thu, 31 Jan 2013 10:10:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Terry Ellison CC: Stas Malyshev , Christopher Jones , Zeev Suraski , "internals@lists.php.net" References: <5d21b42656d49b4a71d9f808541bd745@mail.gmail.com> <51078485.30107@rotorised.com> <11e1ccc6eca996d9d94ae9a3bff0bbab@mail.gmail.com> <5108667C.1030901@oracle.com> <510868DE.7010408@lerdorf.com> <51086DB0.8050706@sugarcrm.com> <51086F59.6030007@lerdorf.com> <510A37E2.6060001@ellisons.org.uk> In-Reply-To: <510A37E2.6060001@ellisons.org.uk> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkF3RDR204QM9U1eJtFBd34Fi+9pUsPo4spvVIyiIzEO5dKcBOfcR25e6NjFRuqtQ4LXu5r Subject: Re: [PHP-DEV] [RFC] Integrating Zend Optimizer+ into the PHP distribution From: rasmus@lerdorf.com (Rasmus Lerdorf) On 01/31/2013 01:22 AM, Terry Ellison wrote: > On 30/01/13 00:54, Rasmus Lerdorf wrote: >> On 01/29/2013 04:47 PM, Stas Malyshev wrote: >>> Hi! >>> >>>> which shows the dreaded zend_optimizerplus.inherited_hack which mimics >>>> APC's autofilter hack. I'd love to get rid of this particular bit of >>>> confusion/code complexity on the integration. >>> Ohh, this one. IIRC that has to do with conditional definition of >>> classes and the fact that script may be compiled in one environment but >>> loaded in another, which may create difference in class tables, >>> especially combined with early binding for inherited classes. Getting >>> rid of it is not that easy until people stop writing code like: >>> if($foo) return; >>> class Foo extends Bar {} >>> which would work differently depending on if Bar is defined or not. >> Yes, I am quite familiar with it since we had to handle this in APC too. >> But I don't think getting rid of it is that hard. It obviously can't be >> done in the opcode cache because by the time the compiler hands us the >> op_array we have already lost the FETCH_CLASS opcode which we may or may >> not need. We need to look at whether that MAKE_NOP() call in the >> compiler is actually a worthwhile optimization in a future where most >> people will be running an opcode cache by default. >> >> This is one of the prime examples of making the compiler more opcode >> cache friendly. Yes, it may be at the slight expense of non-opcode cache >> performance, but with a bundled opcode cache implementation that should >> be less of a worry. > +1. This one makes no sense to me as it simply hoists the > zend_do_inheritance() from runtime binding to compile-time, and this > binding has to be backed out by any opcode cache to work properly. It > might save a few microseconds per class declaration in non-cached > performance, but add factors more to cached performance. Why do this? I agree. And the code doesn't have to be as silly as the example Stas gave. Something as simple as this will hit it: indexA includes child1 and child2 which both extend parent1 indexB includes only child2 Assuming these are all in different files, if you hit indexA first, by the time the compiler gets to child2 parent1 already exists because child1 inheriting from it brought it in so it will be compiled without the FETCH_CLASS opcode. But then you hit the indexB entry point and now the compiled child2 is used in a context that doesn't already provide parent1 so the cached opcodes can't be used here. Of course, if on an empty cache the indexB entry point is hit before the indexA entry point, then everything is fine. child2 will be compiled with the "FETCH_CLASS parent1" intact and this version can be used in both contexts. This is the kind of thing I really don't want to have to explain to people with an integrated cache solution. It is a level of detail the user should never hit. -Rasmus