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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php