-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Container building performance with lazy autowire error messages #32711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please provide an https://blackfire.io comparison before/after the commit you mention? |
Can you please also check if #32715 improves the situation? |
Had to apply this fix to make the specific commit work Here are the profiles: The fix seems to improve the situation but still much time is spent in the setDefinitions method. Let me know if there's anything else I can do |
Thanks for the profile, that's really eliminating the guesswork! |
https://blackfire.io/profiles/76a5be15-be03-4f5b-9d38-af355f647355/graph Now it seems much better |
Thanks, problem solved then. PHP 7.3 will provide an additional perf improvement by reducing the pressure on the GC I think. |
Thank you very much |
…olas-grekas) This PR was merged into the 4.3 branch. Discussion ---------- [DI] fix perf issue with lazy autowire error messages | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32711 | License | MIT | Doc PR | - See linked issue. Commits ------- 3c3bda5 [DI] fix perf issue with lazy autowire error messages
Symfony version(s) affected: 4.3.*
Description
Performance of container building has been degraded after 4.3 update
How to reproduce
https://github.com/bsod85/sf_autowire_performance
By switching the symfony/dependency-injection between 4.2.* and 4.3.*, after a composer update I obtain these results with the command "time bin/console cache:clear":
Version 4.3 -> 107,57s user 0,49s system 99% cpu 1:48,07 total
Version 4.2 -> 24,77s user 0,45s system 99% cpu 25,233 total
Additional context
After a bisect I came to the conclusion that the problem has been introduced in commit 3b3a1bd
The AutowirePass::createTypeNotFouldMessageCallback() method creates a new copy of the entire container for each encountered error.
This severely hinders the performance on big projects if many non-autowirable classes are processed by the "resource" option.
The text was updated successfully, but these errors were encountered: