Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
X Autoload has some bold statements about performance on the module page.
It is bad style to boast with numbers that are not backed up.
We should run some benchmarks to compare with the Symfony loader.
This is what I just did.
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedX Autoload uses (or, *should* use, argh) an APC cache, with a performance comparable to that of other class loaders (Symfony).
However, it really outperforms those other loaders on systems without APC.
It is designed to scale much better with a high number of namespaces.
Here is a "Preview" benchmark result from a local version of xautoload.
The public version currently has the APC cache disabled, so it behaves mostly equivalent to the "xautoload, no apc".
loadClass() 1 x 300
We register 300 namespaces of test modules (in addition to those already installed), and load one class for each.
classloader + apc: 19 ms
xautoload + apc: 20 ms (*)
xautoload + apc + is_file(): 22 ms
xautoload, no apc: 27 ms
classloader, no apc: 82 ms
Repeated findFile() 10 x 300
We register 300 namespaces of test modules (in addition to those already installed), and call 10x findFile() for a class that is already loaded (one for each of the 300 test modules).
classloader + apc: 10 ms
xautoload + apc: 9 ms (*)
xautoload + apc + is_file(): 14 ms
xautoload, no apc: 62 ms
classloader, no apc: 620 ms
(*) The relevant code is almost identical in the cases where APC is enabled.
We assume the difference is just random, and may be different on other machines.
Comment #2
donquixote CreditAttribution: donquixote commentedNote: Again, this is a preview. I am going to upload something to allow others to reproduce, until then it is just my word.
You can have a look at Autoload benchmark in my sandbox, which is what I started with. But it is not the same.
Comment #3
donquixote CreditAttribution: donquixote commentedHere is an updated benchmark, finally using publically available code: xautoload-7.x-3.x, and the latest autoload_benchmark.
Benchmark results: 300 namespaces
(avg microseconds per single operation)
We register 300 test namespaces into each loader, and see how well they perform.
Benchmark results: 100 namespaces
(avg microseconds per single operation)
We register 100 test namespaces into each loader, and see how well they perform.
Legend
The "aggressive" just means that we skip the file_exists() if APC cache has a result, meaning that we potentially crash if that file has moved.
Comment #4
donquixote CreditAttribution: donquixote commentedI think the information on the module page is balanced enough now.