Description
Symfony version affected: 5.1.2
Description
I noticed that there is a huge performance regression of Symfony DI since 5.0.2 according to my benchmarks (https://github.com/kocsismate/php-di-container-benchmarks). The last time I generated the results, Symfony was the clear winner in most of the tests, but now, half a year later, Symfony's performance decreased dramatically, while the results of the other contenders didn't change significantly.
The difference can be observed by looking at the last two benchmark reports:
- Symfony DI 5.0.2: https://rawgit.com/kocsismate/php-di-container-benchmarks/e090203620db91eaa0fa9ffa7f6d71a7f755fc51/var/benchmark.html
- Symfony DI 5.1.2: https://rawgit.com/kocsismate/php-di-container-benchmarks/116a29f0fe497e3f65c18f8b231b972db30e7e95/var/benchmark.html
How to reproduce
You can run the test suite, following the steps detailed in the project's readme.
Possible Solution
Container as well as infrastructure configuration didn't change much since the two benchmark runs, so I would search for the source of issue somewhere else. After a quick look of the generated containers, I noticed that include_once
invocations changed place in the meanwhile, and now they are always performed when a service is retrieved. Maybe this can be blamed for the regression?