Re: Performance Consideration of 1 class per file
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Performance Consideration of 1 class per file | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9543@lists.php.net to get a copy of this message | ||
On Sat, 24 Apr 2004, George Schlossnagle wrote:
> A nitpick - apc now uses device/inode information and not the file name
> as hash keys. It's no less or more expensive before, both require an
> equivalent of realpath() (actually in the apache case the new version
> is twice as efficient as the old - thanks rasmus).
What do you mean by that? APC doesn't require anything near a realpath.
If you get rid of realpath() in PHP, APC will work just fine. With my
syscall hacks I am using APC this way and I just have 1 stat per file.
The only visible difference is when you ask APC which files it has cached
and it doesn't return full-path filenames but rather just the paths used
to include the files.
For the top file there is no stat in PHP/APC at all anymore as we inherit
the stat struct from Apache (which I guess is what you are alluding to)
and then for each include file only a single stat is needed. That is
nowhere near the equivalent of a realpath which adds N stats per file
where N is the depth of the file in the directory structure.
If you are really crazy and want the equivalent of this without hacking
PHP you would make / your doc_root and put all your files there. And
every include would do include ./filename. That would get close. There
are still a couple of stray stats in there that aren't strictly needed.
There is one in the streams code as well that I hacked out.
-Rasmus