[Solar-talk] Performance ideas
Paul M Jones
pmjones at ciaweb.net
Tue Oct 16 18:09:47 CDT 2007
On Oct 16, 2007, at 3:50 PM, Ian Szewczyk wrote:
> I agree about the excessive use file_exists/class_exists when it comes
> to loading classes.
The file_exists() calls generally only get made when the class does
not already exist. And if class_exists() is our big performance
drain, well, I'd say we're doing pretty freaking well then. ;-)
> The fact that every path in the include path is
> scanned makes it a little worse, and then multiply that when used in
> conjunction with the file and class stacks.
Fair enough -- although in practice, the include_path (at least on my
projects) is a single path, with everything descending from the
common PEAR directory. YMMV on that one though, not all external
libs use the PEAR naming conventions.
> I mentioned a while back
> that caching the absolute paths might be a good idea for production
> environments, but its hard to wiggle that in on your own because there
> are dependencies inside the arch class, and the usage of the stack
> classes by the core api is pretty tightly woven in as well.
The stack fallbacks are pretty powerful, but they don't come free. :-
( Not sure how I'd work around that one.
Having said all this, if there *is* an implementation that can
preempt file_exists() and class_exists() calls in a way that has very
high backwards-compatibility, or is compelling enough to allow some
BC breaks, I'd be very happy to review it.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the Solar-talk
mailing list