Andi Gutmans wrote:
At 01:49 AM 4/24/2004 -0700, Rasmus Lerdorf wrote:

Overall I think you would get more bang for the buck by coming up with an
intelligent caching stat/realpath implementation.  The obvious drawback
would be that symlinks and other filesystem changes done while the server
is running would not be seen until a restart.


I also think that the way to solve this problem is to create a realpath cache. I've wanted to do this for ages but never had time to do it. The main reason this is the best approach (in my opinion) is because the fopen() code in PHP is extremely complex and this has gotten much worse with the whole streams implementation. Try and walkthrough an fopen in PHP these days and it's pretty complicated. Also, the fact that we do have file's full path does end up being a very good thing both for functionality and debugging, so I would like to keep it this way.
Creating a realpath() cache would solve this problem from a different angle without having to (barely) change any code in PHP nor streams. As Rasmus mentions, the only downside is refresh, but I think that on a loaded web site (which are the web sites we're talking about), even a 1 minute TTL of cache entries could lead to realpath() being negligible.


Andi

Would these changes be incorporated into PHP4, too?

On a related note -- would it be possible (if not already done) to evaluate dirname(__FILE__) at "parse time", in case that gives you a performance advantage? Or is there a better way to do "real" relative includes?

Cheers,
Michael

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to