Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49886 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53637 invoked from network); 7 Oct 2010 18:21:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2010 18:21:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:61177] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/8A-01054-6AF0EAC4 for ; Thu, 07 Oct 2010 14:21:27 -0400 Received: by iwn41 with SMTP id 41so167669iwn.29 for ; Thu, 07 Oct 2010 11:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=7QOp2CYcY1Epu7oVOOTv2D5LfCbm2h9WflCrMJjpDuY=; b=Mi5lCkuH1/5dpuq8g3IRmvmsa7zmcUvuT+GVjunEzCEDc50TIArIyE9ENucJNRM68B 0/rzxfE9dqc5x4gJC4OjdP3zgsm72+R8fxVLJ9cshqGUYty3Jq0km3KwWhh8ZVlKr4Bh cCZNoK9Sc/ODtj3r54reQCl6/JjgfsZiAQVcE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=xRvbauSWb/pP2i+z5TLlAw/+V99A5rGYzLtw4P5rin6wRuG6nLz0Gzw7K1A33chzGY kbAFYwNE6OCnhvaE7H3EeS+9AYX97rAq5duPSiGJHUIdqcHfQrnCnNTi95PUwZu/EROl y2Xo9sGzykz/lxT2e3TnLCUkidwqE8XhpFgeA= MIME-Version: 1.0 Received: by 10.231.77.155 with SMTP id g27mr1142802ibk.195.1286475683128; Thu, 07 Oct 2010 11:21:23 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.231.157.198 with HTTP; Thu, 7 Oct 2010 11:21:23 -0700 (PDT) In-Reply-To: <73.09.01054.7EC0EAC4@pb1.pair.com> References: <73.09.01054.7EC0EAC4@pb1.pair.com> Date: Thu, 7 Oct 2010 20:21:23 +0200 X-Google-Sender-Auth: Uki4ZCaVTjkBamBJ3J0VdpTjjs0 Message-ID: To: Scott Nichol Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=000e0cd254141ae54104920af6c3 Subject: Re: [PHP-DEV] stat functions do each path component? From: info@tyrael.hu (Ferenc Kovacs) --000e0cd254141ae54104920af6c3 Content-Type: text/plain; charset=UTF-8 On Thu, Oct 7, 2010 at 8:09 PM, Scott Nichol wrote: > In comparing the performance of PHP 5.2.5 file_exists calls versus C stat > calls, I discovered via Windows sysinternals > ProcessMonitor that PHP seems to do a stat on each component of a file > path. For example, > file_exists("e:\\wamp\\www\\ra-v2\\system\\application\\libraries\\MY_Controller.php") > appears to stat "E:\wamp", "E:\wamp\www", > etc., finally getting to the file. That compares to doing _stat64 of > "e:\\wamp\\www\\ra-v2\\system\\application\\libraries\\MY_Controller.php" > in C, which just does the stat on the file. The timings > from my tests show the C app finishing in about one-seventh the time, which > is what I would expect from the PHP code doing seven > times as many stat calls. > > Assuming my inference about all the stat calls is correct, is there a > rationale for this? If the PHP app I am working on made just > a couple of file_exists calls, I would not bother to ask, but it uses the > CodeIgniter framework which is doing >100 file_exists > calls for each page being accessed, so the affect is very noticeable. > > FYI, I poked around the PHP SVN web interface for a while and found > php_check_open_basedir_ex called in plain_wrapper.c, which I > suspect causes the calls, but ran out of steam before confirming the cause > of the behavior. > > TIA > -- > Scott Nichol > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Hi. This was discussed before. see http://www.mail-archive.com/internals@lists.php.net/msg37211.html Tyrael --000e0cd254141ae54104920af6c3--