Description
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.