rfc:autoload_classmap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:autoload_classmap [2021/03/15 17:28] marandallrfc:autoload_classmap [2021/03/19 18:37] marandall
Line 2: Line 2:
   * Version: 1   * Version: 1
   * Date: 2021-03-15   * Date: 2021-03-15
-  * Author: Mark Randall, mrandall@php.net+  * Author: Mark Randall, marandall@php.net
   * Status: Under Discussion   * Status: Under Discussion
   * Target: 8.1   * Target: 8.1
Line 35: Line 35:
  
 If the classmap is not set, or the class name cannot be found within the classmap, the autoloader will continue to perform its traditional behaviour of iterating over the functions specified by spl_autoload_register.  If the classmap is not set, or the class name cannot be found within the classmap, the autoloader will continue to perform its traditional behaviour of iterating over the functions specified by spl_autoload_register. 
 +
 +===== Performance =====
 +
 +Testing suggests that autoloading through an internal classmap delivers around 5% performance increase vs a userland function call (e.g. composer). 
 +
 +This is 5% of the cost of the autoloading, and not the execution as a whole. Testing was performed by creating 50,000 empty classes each in an individual file, and then autoloading every one of them in a loop. Amount of classes was purely to help reduce noise.
 +
 +Average for internal classmap was 0.295 vs 0.313 for spl_autoload_register representing 5.9% difference (in autoload performance only).
 +
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
rfc/autoload_classmap.txt · Last modified: 2021/04/06 05:32 by marandall