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
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

Crell - January 15, 2009 - 19:29

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

Crell - March 17, 2009 - 21:58
Version:6.x-1.2» 6.x-1.x-dev
Status:active» fixed

Committed.

#3

System Message - March 31, 2009 - 22:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.