Skip to content

Commit e5e27af

Browse files
committed
bug symfony#13991 [Dependency Injection] Improve PhpDumper Performance for huge Containers (BattleRattle)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes symfony#13991). Discussion ---------- [Dependency Injection] Improve PhpDumper Performance for huge Containers | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT After making public services private, the dumping of the DIC takes much longer. This is due to the reference lookup method. Using the visited lookup as reference speeds up the whole dump (in our case by a factor of ~40). Some stats from our DIC: before: 32 sec. for dumping after: 0.9 sec. Commits ------- 2cc5011 use visited lookup with reference to gain performance
2 parents 052735d + 2cc5011 commit e5e27af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ private function getDefinitionsFromArguments(array $arguments)
11511151
*
11521152
* @return bool
11531153
*/
1154-
private function hasReference($id, array $arguments, $deep = false, $visited = array())
1154+
private function hasReference($id, array $arguments, $deep = false, &$visited = array())
11551155
{
11561156
foreach ($arguments as $argument) {
11571157
if (is_array($argument)) {

0 commit comments

Comments
 (0)