On 6/23/10 6:56 AM, Wietse Venema wrote: > Stas Malyshev: >> Hi! >> >>> could anybody tell me why also for every single php file engine must lstat >>> all path? >>> Why php engine don't simply try to open directly the file? >> >> There are some places where PHP engine has to know "true" name of the >> file - i.e. filename that would be the same for each file regardless of >> how it is accessed - through relative path, symlinks, etc. Example can >> be {include|require}_once. For that, it needs to figure out the whole >> path. It is done only once per file, then cached. If you seeing it on >> repeated runs in the same process, increase your realpath cache size >> (yes, the default is way too small for any big app). > > Another option may be to compute a hash of the file. When you find > that file content has the same hash value as a known file you flag > them as "same file". This could be faster (file contents are cached > in main memory because the OS already knows the files are the same, > and finding the "real" name of a file is a slow process).
When properly configured the realpath result should be cached as well though and we avoid calling a hash function on what could potentially be a lot of data. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php