composer dump-autoload --optimize

07 Apr 2014

Just came across the composer.json cheatsheet.

One thing that I noticed was the line: php composer.phar dump-autoload --optimize

Use --optimize to convert PSR-0 autoloading to classmap to get a faster autoloader. This is strongly recommended for production (you can get a 20% boost), but can take a bit of time to run so it is currently not done by default.

From my reading the performance improvement is biggest when using an opcode cache like APC or OPCache. I'm in the process of setting up a new server that will be using OPCache, so it'll be interesting to see the difference in performance once it is ready to go. One for a follow-up post.