fix: Set autoloader to be --classmap-authoritative#962
fix: Set autoloader to be --classmap-authoritative#962nlemoine wants to merge 1 commit intoAdvancedCustomFields:masterfrom
--classmap-authoritative#962Conversation
|
Hello @mattgrshaw, Can you have a look at that PR? Using composer in WordPress plugin context should be done responsibly as it can seriously hurt performance. On a large project loading a fair amount of classes, ACF is causing a file lookup for over 4000+ classes. It's a ~15ms performance penalty on my case (profiled with Blackfire so this metric can be trusted). Please read more about And especially: https://getcomposer.org/doc/articles/autoloader-optimization.md#what-does-it-do--2 TL;DR; Unless you create PHP classes on the fly (which ACF don't), this PR can be merged safely and will bring benefits to all your users. It will just tell your autoloader to not look for other files (including all user/plugin/theme autoloaded PHP classes) than the ones that are in your class map. |
|
Hey @nlemoine, Thanks for your suggestion. We'll look to add this in our next release. |
|
Closing the PR as we'll need to add this upstream into our build pipeline. |
|
Awesome! Thanks @lgladdy Looking forward to that. |
This will tell your Composer autoloader to only look for classes in the declared folders (improved performance/safety).
See: https://naderman.de/slippy/slides/2017-07-13-T3DD17-Composer-Best-Practices.pdf
And: composer/composer#10205 (comment)