Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36164 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44855 invoked from network); 17 Mar 2008 08:07:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2008 08:07:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:22605] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/ED-00283-BB62ED74 for ; Mon, 17 Mar 2008 03:07:25 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Mar 2008 10:07:41 +0200 Message-ID: <06B0D32C7A96544490D18AF653D6BDE502759909@il-ex1.zend.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Patch for opcode caches Thread-Index: AciF+EEug5sQh3NJT2+izBve+g/gWQCDQT7Q To: "Marcus Boerger" , "Stas Malyshev" Cc: "Andi Gutmans" , "phpxcache" , Subject: RE: [PHP-DEV] Patch for opcode caches From: dmitry@zend.com ("Dmitry Stogov") > -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net]=20 > Sent: Friday, March 14, 2008 8:24 PM > To: Stas Malyshev > Cc: Dmitry Stogov; Andi Gutmans; phpxcache; internals@lists.php.net > Subject: Re: [PHP-DEV] Patch for opcode caches >=20 >=20 > Hello Stanislav, >=20 > Friday, March 14, 2008, 5:51:49 PM, you wrote: >=20 > >> But that means we are compiling inheritance when a file is loaded=20 > >> form the cache. The goal should be to compiling inheritance when=20 > >> writing to the opcode cache file. All we achieve here is a=20 > slow down.=20 > >> If there is >=20 > > You can not do that. You do not know that until runtime. >=20 > >> something that makes this required than at least we need=20 > to warn the=20 > >> user about the slow code. I Think what we need to do is=20 > deprecating=20 > >> class and >=20 > > It won't be slow. It would be much faster (in some cases=20 > 10x faster). > > This specific assembly of instructions might be slower in=20 > some cases,=20 > > but the code altogether will be faster. That's the idea of=20 > the opcode=20 > > caches. >=20 > >> namespace use in non main blocks as well as include and require in=20 > >> non main blocks. And if there is no such case than=20 > everything can be=20 > >> bound early which is the fast state we should aim for. >=20 > Lemme just think, doing inheritance at compile time before we=20 > send the stuff to an opcode cache can be slower then? It's always faster, but with opcode caches we cannot always do it in compile-time, because the parent (in another file) might be changed on next load of children class. > How is=20 > that possible? After all late binding means we do it at run=20 > time. And no matter how much faster we can do it. It will=20 > always be slower than doing the same thing only once. >=20 > > We do not need to deprecate anything, and inheritance can=20 > not be bound > > before parent class is known, which in the case of bytecode=20 > cache means=20 > > - not before the file is loaded from the cache. That's=20 > exactly what this=20 > > patch enables. It does not change performance=20 > characteristics of neither=20 > > cached not non-cached code, it just makes it much simpler=20 > and working in=20 > > all cases. >=20 > Inheritance cannot be done before the parent class is known.=20 > We still need to do the prototype checks even if we assume=20 > the class is there and insert a virtual class as parent somehow. Right. This is the reason why we need to delay early binding. But we don't like to delay it to run-time, because it will breake the class creaton order and as result may breake some scripts. Thanks. Dmitry.