Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39951 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67981 invoked from network); 14 Aug 2008 06:37:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2008 06:37:33 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 76.96.62.56 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 76.96.62.56 qmta06.westchester.pa.mail.comcast.net Received: from [76.96.62.56] ([76.96.62.56:43855] helo=QMTA06.westchester.pa.mail.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/8A-05165-CA2D3A84 for ; Thu, 14 Aug 2008 02:37:33 -0400 Received: from OMTA06.westchester.pa.mail.comcast.net ([76.96.62.51]) by QMTA06.westchester.pa.mail.comcast.net with comcast id 26E01a00B16LCl0566dWjh; Thu, 14 Aug 2008 06:37:30 +0000 Received: from earth.ufp ([24.13.255.226]) by OMTA06.westchester.pa.mail.comcast.net with comcast id 26dV1a00E4trKQ83S6dW14; Thu, 14 Aug 2008 06:37:30 +0000 X-Authority-Analysis: v=1.0 c=1 a=n-O3kHwuCEAA:10 a=EqItlBBJfh84JasfLP4A:9 a=3YgDClybt8tagdZ8xGUA:7 a=tekSVvjEnBY0XsQ_vVv1Ly0CpSUA:4 a=FHBbIDN7CdwA:10 a=LY0hPdMaydYA:10 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id 7B62FD7A04 for ; Thu, 14 Aug 2008 01:37:29 -0500 (CDT) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.ufp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g0ei+qGEUUBF for ; Thu, 14 Aug 2008 01:37:29 -0500 (CDT) Received: from luna (unknown [192.168.42.7]) by earth.ufp (Postfix) with ESMTPSA id 48155D79F5 for ; Thu, 14 Aug 2008 01:37:29 -0500 (CDT) To: internals@lists.php.net Date: Thu, 14 Aug 2008 01:37:28 -0500 User-Agent: KMail/1.9.9 References: <909776579.20080803142659@marcus-boerger.de> <200808140027.53442.larry@garfieldtech.com> <48A3C45D.10400@lerdorf.com> In-Reply-To: <48A3C45D.10400@lerdorf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200808140137.28106.larry@garfieldtech.com> Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: larry@garfieldtech.com (Larry Garfield) On Thursday 14 August 2008 12:36:29 am Rasmus Lerdorf wrote: > Larry Garfield wrote: > > I would also note that "include up front and have a good autoload scheme" > > works great if you are writing all classes. If you're trying to use > > namespaces and functions, there is no autoload. That makes the autoload > > argument moot, and pre-loading everything up front can get ridiculously > > expensive in large systems, and even then you don't always know what to > > load up front. (Think anything that accepts plugins.) So an answer of > > "well if it throws a warning when you do that, don't do that" is simply > > not realistic in practice. > > With an opcode cache, it is actually often more efficient to load > everything up front even if you aren't using it all on any given > request. By using autoload or other conditional mechanisms you lose the > function and class caching mechanism provided by the opcode cache > because you have now pushed the creation of these to the executor > instead of letting the opcode cache cache them for you. > > And assuming your include_path setting and your include hierachy is > clean so you don't have any or at least only minimal per-include stat > overhead, whether you include 1 or 20 files on a request isn't a big > deal since they are all going to be in memory anyway. > > -Rasmus For better or worse 99% of the code I write runs on systems without an opcode cache 99% of the time so that's what I optimize for. That it is apparently impossible to optimize for both opcode caching and non-opcode caching environments at the same time (the former hates conditional include, the latter loves it) is a problem in itself, although I will be honest that I have never fully understood the reasons for it. (Doesn't the opcode cache just recognize "oh yeah, file /foo/bar/baz.php, I've got that parsed already I'll just add that to the runtime environment"?) Even then, every benchmark I've seen for Drupal (the system I work on) still gives a several-fold increase in runtime performance with an opcode cache, so I am not super worried about eeking out every last CPU cycle. We also by nature have to support user-pluggable modules, which cannot be statically included. There's also memory usage to consider. In our testing, conditional includes sliced 25% off of the memory usage when not using an opcode cache and had no noticeable effect when using an opcode cache, so that's still a big win for larger code bases. We're working at making even more code conditionally included in the next version for that exact reason. In any case, the point I am making is that saying "well, don't use conditional includes and namespaces" or "don't use functions and namespaces" is a non-option. Either of those pretty much guarantees that we (Drupal) will never be able to use namespaces in practice. -- Larry Garfield larry@garfieldtech.com