Re: Performance problem with php
| From: | Stas Malyshev | Date: | Wed, 23 Jun 2010 18:40:49 +0000 |
| Subject: | Re: Performance problem with php | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-48955@lists.php.net to get a copy of this message | ||
Hi!
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 cachedFirst, two files with the same content is not the same as same file referred twice with different name. Second, to know that I'd need to open and read the whole file and then compute the hash of it - which sounds quite expensive. Right now with proper caching non-including include_once can be done with 0 system calls (unfortunately, pure PHP doesn't do it yet, though IIRC Zend's Optimizer+ does - not sure about APC).
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).It's only slow process once, then it's cached. And I'm not sure it's faster to load all the file into memory then check it's path. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227