Note: This is meant to always remain a sandbox project.
"Autoload benchmark" is a tool to measure the performance of PSR-0 class loading on your site.
Especially, it measures how well the classloader solution scales with a high number of modules.
Typically you want to compare these two modules:
- http://drupal.org/project/xautoload - a rewrite of the D8 class loader with performance and flexibility in mind.
- http://drupal.org/project/classloader - a direct port of the D8 class loader.
The case that we test is
- 300 test modules with a "lib" folder for class loading
- 300 classes to be loaded, one from each of the 300 test modules.
- Create an arbitrary Drupal 7 site.
- Install autoload_benchmark.
- Disable all modules/themes that have a dependency on xautoload or classloader.
- Install + enable "classloader" module. Make sure that xautoload is disabled
- Run "drush autoload-benchmark"
- Install + enable "xautoload" module. Optionally disable "classloader".
- Run "drush autoload-benchmark". Compare the numbers.
- Play with different settings for APC cache on classloader. I think on xautoload you need to hack around, to disable apc cache? I don't remember.
- Play with the "generate.php" script, to try numbers other than 300. But, be careful which modules are enabled or disabled!
On my server I got a considerable improvement by using xautoload instead of classloader.
The weird thing is, apc cache did not seem to make any difference.
0.1 seconds with xautoload
0.3 seconds with classloader
for this particular task.
Everyone, go ahead and prove me wrong :)