Timwi wrote:
I have a small patch (2k lines) that eliminates most of require_once() calls and uses require() in __autoload() handler. Generally it makes things faster, as less require_once means less stat(), as well as that might be more APC-friendly.
Not questioning anything, but out of interest: I don't understand how this saves any stat()s? Surely multiple calls to require_once for the same file still require only one stat().
Apparently not, particularly if you're using relative paths (as we have traditionally). As I've heard this explained, the stat()s here are done in require_once itself so the opcode cache plugin can't avoid them.
Note that you can also tell APC to cheat and *never* itself stat for files that have been cached: in this case you need to explicitly clear the opcode cache when pushing updated files. If using require() this might get you totally stat-free. (In theory.)
-- brion vibber (brion @ pobox.com)