Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

- added optimized dump-autoload after di:compile to make sure that it contains dynamically generated classes #16

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

pknap
Copy link
Contributor

@pknap pknap commented Oct 7, 2024

Currently, Magento recipe does not run composer dump-autoload after setup:di:compile.

This means that all classes generated dynamically by Magento DI are not included in composer classmap and all references to those classes during runtime generate performance degradation caused by excessive file_exists calls.

Running dump-autoload after di:compile is recommended by official docs:

https://experienceleague.adobe.com/en/docs/commerce-operations/performance-best-practices/deployment-flow#preprocess-dependency-injection-instructions

and also included in the default deployer recipe maintained by the community:

https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L169

Hence I propose adding it in the default recipe. I tested it directly on one of the projects, giving 20-40ms performance gain on average request.

@pknap pknap merged commit 6e537dd into main Oct 7, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants