Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39005 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46937 invoked from network); 16 Jul 2008 13:45:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2008 13:45:57 -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 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:38430] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/EF-54589-39BFD784 for ; Wed, 16 Jul 2008 09:45:56 -0400 Received: from [192.168.200.148] (c-24-6-219-206.hsd1.ca.comcast.net [24.6.219.206]) (authenticated bits=0) by mail.lerdorf.com (8.14.3/8.14.3/Debian-4) with ESMTP id m6GDjgws031197; Wed, 16 Jul 2008 06:45:50 -0700 Message-ID: <487DFB86.3030404@lerdorf.com> Date: Wed, 16 Jul 2008 06:45:42 -0700 User-Agent: Thunderbird/3.0a2pre (Macintosh; 2008071516) MIME-Version: 1.0 To: Arvids Godjuks CC: Oleg Grenrus , PHP Internals List References: <1216133436.6875.35.camel@amirh> <487CEF26.7030802@lerdorf.com> <1216159988.28846.12.camel@localhost> <487D22AE.20109@lerdorf.com> <5a2b1bf10807152247r563092a6l88d555d2389506e4@mail.gmail.com> <9b3df6a50807160340w578d7490xb6f2810652e1bb47@mail.gmail.com> In-Reply-To: <9b3df6a50807160340w578d7490xb6f2810652e1bb47@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mail.lerdorf.com [204.11.219.139]); Wed, 16 Jul 2008 06:45:50 -0700 (PDT) Subject: Re: [PHP-DEV] lstat call on each directory level From: rasmus@lerdorf.com (Rasmus Lerdorf) Arvids Godjuks wrote: > Hello. > > I think this should be optimized. > I'm not an expert ofcourse, but as I understood there is only one case > witch need a special treatment - require/include _one when a file with > equal contents is included from different directories. > You can make a switch witch controls if lstat is made or not in these > cases. People who know what they are doing will switch it to off and > make sure their includes don't result in Fatal error (anyway, to my > opinion it is bad desing if such thing happens). > Ofcourse open_basedir users will don't have any benefit from it, but > that's their choise. > So I think you should think it out and make this optimization to 5.3 > release. It would be great optimization, IMHO. But all these lstats should be getting cached, so I don't see how it would affect performance very much. If you are blowing your realpath cache, you need to take a look at why that is happening. We probably should disconnect clearstatcache() from the realpath_cache, and we could perhaps look at doing partial path caches through our own realpath implementation. The other thing that can suck is when you have an include_path miss. We don't cache misses like this, so if you are relying on include_path to find your files and you don't hit it on the first try, you are going to see a bunch of stats. But that is again something that is easily fixed by not writing crappy code. I think that breaking code that looks like this: require_once './a.inc'; require_once 'a.inc'; require_once '../a.inc'; require_once 'includes/a.inc'; when these all refer to the same a.inc file depending on where the parent file is and what the coder had for breakfast that morning would be a very bad idea. -Rasmus