Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DI] Improve performance of removing/inlining passes#27471

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Tobion merged 1 commit intosymfony:masterfromnicolas-grekas:di-perf
Jun 5, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedJun 1, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#27386
LicenseMIT
Doc PR-

Here is an optimization to reclaim some compilation time by optimizing the analysis of unused and inlined services.

This PR removes any use case forRepeatedPass, instead:

  • RemoveUnusedDefinitionsPass works in one run, removing all private services that are unreachable from public services
  • InlineServiceDefinitionsPass reduces the number of nodes to analyze per iteration usingAnalyzeServiceReferencesPass on a duplicated container internally.

https://blackfire.io/profiles/compare/00723822-6c09-431c-b98d-4a4197d044fc/graph?settings%5Bdimension%5D=wt&settings%5Bdisplay%5D=focused&settings%5BtabPane%5D=nodes&selected=Symfony%5CComponent%5CDependencyInjection%5CCompiler%5CRepeatedPass%3A%3Aprocess&callname=Symfony%5CComponent%5CDependencyInjection%5CCompiler%5CRepeatedPass%3A%3Aprocess

image

Koc and andreybolonin reacted with thumbs up emoji
@nicolas-grekas
Copy link
MemberAuthor

@tarlepp since you reported a slowdown on Slack, can you please try this PR and report any results?

@staabm
Copy link
Contributor

The blackfire link in the desc doesnt work

@nicolas-grekas
Copy link
MemberAuthor

@staabm updated thanks.

Note that our test suite is pretty nice on this topic, coverage is pretty great. I also used this patch to compile Blackfire's container, and it produces exactly same output. Confidence is good on my side :)

@nicolas-grekasnicolas-grekas changed the base branch frommaster to4.1June 3, 2018 08:35
@nicolas-grekasnicolas-grekasforce-pushed thedi-perf branch 2 times, most recently from0bf53a9 toae832d5CompareJune 3, 2018 21:19
@nicolas-grekasnicolas-grekas changed the base branch from4.1 tomasterJune 3, 2018 21:27
@nicolas-grekasnicolas-grekas modified the milestones:4.1,nextJun 3, 2018
@nicolas-grekasnicolas-grekasforce-pushed thedi-perf branch 2 times, most recently from21effb3 to75114e9CompareJune 4, 2018 06:41
Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

UPGRADE notes are missing

*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @deprecated since Symfony 4.1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

4.2 :)

er1z reacted with thumbs up emoji

namespaceSymfony\Component\DependencyInjection\Compiler;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.1.', RepeatedPass::class),E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

same

er1z reacted with thumbs up emoji
@nicolas-grekas
Copy link
MemberAuthor

Do we need upgrade notes here? This is mostly internal thing IMHO.

foreach ($this->graph->getNode($id)->getInEdges()as$edge) {
$srcId =$edge->getSourceNode()->getId();
$this->connectedIds[$srcId] =true;
if ($edge->isWeak()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if an edge is weak, other edges will not be marked as connected here. Is is expected ?

}

if (count(array_unique($ids)) >1) {
if (1 !==\count($srcIds)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

what is the difference between\count($srcIds) and$srcIdsCount ? If$srcIdsCount is the number of references (and so a single service referencing it multiple times is counted multiple times), the variable name is not clear.

);

if ($this->inExpression) {
$this->inExpression =false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

why making itfalse again ? Wouldn't this break in case an expression is referencing multiple services ?

*/
publicfunctionprocess(ContainerBuilder$container)
{
$this->enableExpressionProcessing();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Are you sure about that ? Replacing a reference inside the expression won't change the expression anyway. It will keep using the alias.

*/
publicfunctionprocess(ContainerBuilder$container)
{
$this->enableExpressionProcessing();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Are you sure about that ? Replacing a reference inside the expression won't change the expression anyway. It will keep using the alias.

@nicolas-grekas
Copy link
MemberAuthor

@stof agreed, thanks for the review, comments addressed.

@Tobion
Copy link
Contributor

Thank you@nicolas-grekas.

@TobionTobion merged commitcf375e5 intosymfony:masterJun 5, 2018
Tobion added a commit that referenced this pull requestJun 5, 2018
…nicolas-grekas)This PR was merged into the 4.2-dev branch.Discussion----------[DI] Improve performance of removing/inlining passes| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#27386| License       | MIT| Doc PR        | -Here is an optimization to reclaim some compilation time by optimizing the analysis of unused and inlined services.This PR removes any use case for `RepeatedPass`, instead:- `RemoveUnusedDefinitionsPass` works in one run, removing all private services that are unreachable from public services-  `InlineServiceDefinitionsPass` reduces the number of nodes to analyze per iteration using `AnalyzeServiceReferencesPass` on a duplicated container internally.https://blackfire.io/profiles/compare/00723822-6c09-431c-b98d-4a4197d044fc/graph?settings%5Bdimension%5D=wt&settings%5Bdisplay%5D=focused&settings%5BtabPane%5D=nodes&selected=Symfony%5CComponent%5CDependencyInjection%5CCompiler%5CRepeatedPass%3A%3Aprocess&callname=Symfony%5CComponent%5CDependencyInjection%5CCompiler%5CRepeatedPass%3A%3Aprocess![image](https://user-images.githubusercontent.com/243674/40884496-c31e780e-6714-11e8-8218-967c4b25b9ce.png)Commits-------cf375e5 [DI] Improve performance of removing/inlining passes
@nicolas-grekasnicolas-grekas deleted the di-perf branchJune 5, 2018 19:35
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof approved these changes

@chalasrchalasrchalasr approved these changes

+2 more reviewers

@TaluuTaluuTaluu left review comments

@TobionTobionTobion approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

7 participants

@nicolas-grekas@staabm@Tobion@Taluu@stof@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp