3

I don't understand the description of the composer dump-autoload command :

If you need to update the autoloader because of new classes in a classmap package for example, you can use "dump-autoload" to do that without having to go through an install or update.
Additionally, it can dump an optimized autoloader that converts PSR-0/4 packages into classmap ones for performance reasons. In large applications with many classes, the autoloader can take up a substantial portion of every request's time. Using classmaps for everything is less convenient in development, but using this option you can still use PSR-0/4 for convenience and classmaps for performance. 

Why does it says dump ... for performance reasons ? Why dumping the optimized loader ? Is it 'dumping for' or 'converts for performance reason' ?

If it's 'dumping for performance', why then it says classmaps for performance ?

If it's 'converts for performance', why then dumping the autoloader ?

I'm confused.

trogne
  • 3,402
  • 3
  • 33
  • 50

2 Answers2

4

It dumps a classmap that is used by the autoloader. This way, the autoloader doesn't need to search through the filesystem to find the correct file, it already knows the file. This will save time.

Wouter J
  • 41,455
  • 15
  • 107
  • 112
2

Classmaps are not faster in every case. Be careful and measure the benefit you'd get from them before using it in production.

See my answer here for details: Why use a PSR-0 or PSR-4 autoload in composer if classmap is actually faster?

Community
  • 1
  • 1
Sven
  • 69,403
  • 10
  • 107
  • 109