-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] fine tune dumped factories #27268
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
Conversation
Can't we merge this in lower branches too? |
that's not a bugfix but an improvement, so that's for master |
continue; | ||
} | ||
$ids = array(); | ||
foreach ($node->getInEdges() as $edge) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend to extract that whole logic into a new private method for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
da466eb
to
09314e1
Compare
@@ -68,6 +69,7 @@ class PhpDumper extends Dumper | |||
private $inlineRequires; | |||
private $inlinedRequires = array(); | |||
private $circularReferences = array(); | |||
private $singlePrivateIds = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment. I didn't like the $singlePrivateIds
var name, so I looked for English words that mean "used once" and maybe it could be better to rename this to $singleUsePrivateIds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
09314e1
to
0be8bf7
Compare
@@ -1798,6 +1804,22 @@ private function isHotPath(Definition $definition) | |||
return $this->hotPathTag && $definition->hasTag($this->hotPathTag) && !$definition->isDeprecated(); | |||
} | |||
|
|||
private function isSingleUsePrivateNode(ServiceReferenceGraphNode $node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool return declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not on 3.4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but OK on master :)
0be8bf7
to
88ecd0d
Compare
Thank you @nicolas-grekas. |
This PR was merged into the 4.2-dev branch. Discussion ---------- [DI] fine tune dumped factories | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Here is an optimization we forgot in the dumped container: when a private service is referenced once, there is no need to keep it in the internal registry as it will never be reused. This should help a bit the garbage collection process. Commits ------- 88ecd0d [DI] fine tune dumped factories
…services (chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [DI] Fix dumping expressions accessing single-use private services | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29403 | License | MIT | Doc PR | n/a Introduced in #27268, see fixed ticket Commits ------- d1e84aa [DI] Fix dumping expressions accessing single-use private services
Here is an optimization we forgot in the dumped container: when a private service is referenced once, there is no need to keep it in the internal registry as it will never be reused. This should help a bit the garbage collection process.