Re: Reducing the number of system calls for includes
| From: | Rasmus Lerdorf | Date: | Sat, 25 Jan 2003 10:30:36 +0000 |
| Subject: | Re: Reducing the number of system calls for includes | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93669@lists.php.net to get a copy of this message | ||
> That said, we could possibly have a fast mode and use fstat() to get some
> device information on the open file. I am worried about functionality
> though. I'm not sure it's worth breaking.
Yes, fstat() is fast. And perhaps it isn't worth breaking functionality
across the board, but in my particular case I don't really have a choice.
It is simply too slow to handle the loads that it needs to handle and
either I need to get twice as many machines or I need to lose some
functionality.
Another idea would be to try to streamline the normal case for an absolute
pathname. How about doing a readlink() on it. If that tells us that it
is a link, then we know there is something funky and we can do a realpath,
otherwise we just assume it is canonical assuming there are no . .. or //
in the filename in which case we fall back to a realpath() as well.
Or, the really straightforward dumbass solution, have some hint we can
pass along that tells the parser to treat what follows as a canonical
filename.
include "\001/home/rasmus/foo/u2.inc";
A bit too hacky I guess. Perhaps something like:
include_canonical "/home/rasmus/foo/u2.inc";
And we would simply assume that this is a canonical filename and skip all
the checks. This last one is probably what I will need to do, but I will
do some tests on the readlink() optimization and see if that buys me
anything.
-Rasmus