require_once is redundant and expensive
jtsnow - January 15, 2009 - 06:43
| Project: | Autoload |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Great module! I began writing a similar one before I found this one.
One thought:
Using require_once() in the autoload_class() function is redundant. autoload_class() is only called when php can't find a class definition. If the file containing a class was already included, the class defenition would already be loaded and autoload_class() would not be called. Also, many articles on php performance and optimization recommend not using require_once and include_once wherever possible because they are much more expensive operations.

#1
That's probably true, yes. Can you roll a quick patch to change that, and test it to make sure there's no mystery bugs we aren't thinking of?
#2
Committed.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.