Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2167 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91710 invoked from network); 4 Jun 2003 17:28:29 -0000 Received: from unknown (HELO www.lerdorf.com) (66.93.78.119) by pb1.pair.com with SMTP; 4 Jun 2003 17:28:29 -0000 Received: from rasmus2.corp.yahoo.com (rasmus2.corp.yahoo.com [207.126.232.175]) by www.lerdorf.com (8.12.9/8.12.9/Debian-3) with ESMTP id h54HSSKN001391; Wed, 4 Jun 2003 10:28:28 -0700 Date: Wed, 4 Jun 2003 10:28:23 -0700 (PDT) To: "Ilia A." cc: Jeff Moore , internals@lists.php.net In-Reply-To: <200306041327.14883.ilia@prohost.org> Message-ID: References: <200306041327.14883.ilia@prohost.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2 From: rasmus@lerdorf.com (Rasmus Lerdorf) On Wed, 4 Jun 2003, Ilia A. wrote: > Here is an analysis of the situation as it stands with PHP 4.3.3. As far as I > can tell that even when opening files with the full path we do a lot of > completely unnecessary work. > > We start from expand_filepath() which, gets called when opening a file. This > function does a getcwd() everytime it is called even if path is full > (/path/to/script.php), as far as I can tell completely useless syscal. Yeah, I have killed all that crap here. My expand_filepath() looks like this: int len = strlen(filepath); if(filepath[len-1] == PHP_DIR_SEPARATOR) len--; if(!real_path) real_path = estrdup(filepath); else strcpy(real_path, filepath); real_path[len]='\0'; return real_path; Which of course breaks some stuff. I also hacked up the following: - got rid of the pipe check in _php_stream_fopen_from_file() - the fstat() in the sanity check in _php_stream_fopen() - the seek stuff in _php_stream_cast() > Now, the interesting part, which I've yet to track down, are 6 lstat64() calls > that occur between getcwd() (look above) and the actual open() for every file > opened by PHP regardless of whether it had a full path or not. Looks like a realpath() call to me. -Rasmus