Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46019 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39498 invoked from network); 11 Nov 2009 00:50:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2009 00:50:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 209.85.210.192 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 209.85.210.192 mail-yx0-f192.google.com Received: from [209.85.210.192] ([209.85.210.192:36141] helo=mail-yx0-f192.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/A2-38546-D3A0AFA4 for ; Tue, 10 Nov 2009 19:50:06 -0500 Received: by yxe30 with SMTP id 30so635378yxe.29 for ; Tue, 10 Nov 2009 16:50:03 -0800 (PST) Received: by 10.90.16.35 with SMTP id 35mr1272490agp.54.1257900603101; Tue, 10 Nov 2009 16:50:03 -0800 (PST) Received: from monster.local ([76.84.35.200]) by mx.google.com with ESMTPS id 8sm590289yxb.7.2009.11.10.16.50.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 10 Nov 2009 16:50:02 -0800 (PST) Message-ID: <4AFA0A38.7000502@chiaraquartet.net> Date: Tue, 10 Nov 2009 18:50:00 -0600 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070807) MIME-Version: 1.0 To: Stanislav Malyshev CC: internals@lists.php.net, Christian Schneider , Lukas Kahwe Smith References: <413588E2-8AC8-49F7-B7BF-97BEFB0A71E4@pooteeweet.org> <4AF9A03E.8000207@cschneid.com> <4AF9AE1A.9000005@zend.com> <4AF9C589.3090604@chiaraquartet.net> <4AF9CCEA.1030500@zend.com> <4AFA0449.2030600@chiaraquartet.net> <4AFA0756.4020609@zend.com> In-Reply-To: <4AFA0756.4020609@zend.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: alternative to the fopen() hack in autoloaders From: greg@chiaraquartet.net (Greg Beaver) Stanislav Malyshev wrote: > Hi! > >> A good point. Fortunately, most streams do store the filename in the >> stream struct, so this would still probably be possible in the majority >> of cases. If not available, the original requested filename is used >> (the one from the fopen call), so opcode caches probably could just use >> that. > > The problem is, by then the stream will already be opened, i.e. extra > filesystem call is done. Hi, Yes, but let's not forget we're talking about making this: into this: Of course 1 stat is worse than no stats. Perhaps better would be to introduce a function: if (can_include($file)) { include $file; } opcode caches could easily snag this, as we could provide a simple hook the way we do with stream_resolve_path(). That would actually make a 0-stat smart autoloader a possibility. Just in case it isn't obvious, can_include() would be the equivalent to an include_path search followed by is_readable(), which is essentially what the fopen() hack does now. can_include() would also remove the unnecessary opening of the file that fopen() performs. Greg