Skip to content
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

SyntaxValueProvider: avoid performance issue with syntax list containing many items #83483

Merged
merged 3 commits into from Mar 21, 2023

Conversation

cston
Copy link
Member

@cston cston commented Mar 15, 2023

@ghost
Copy link

ghost commented Mar 15, 2023

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

Issue Details

See dotnet/roslyn#66475

Author: cston
Assignees: cston
Labels:

area-Extensions-Logging

Milestone: -

@tarekgh
Copy link
Member

tarekgh commented Mar 16, 2023

@cston is there is benchmark numbers show the improvement?

@ghost
Copy link

ghost commented Mar 16, 2023

Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices
See info in area-owners.md if you want to be subscribed.

Issue Details

See dotnet/roslyn#66475

Author: cston
Assignees: cston
Labels:

area-System.Runtime.CompilerServices

Milestone: -

@tarekgh tarekgh added this to the 8.0.0 milestone Mar 16, 2023
@cston
Copy link
Member Author

cston commented Mar 16, 2023

is there is benchmark numbers show the improvement?

From a couple of runs of the added test LoggerMessageGeneratorParserTests.SyntaxListWithManyItems, elapsed time before: 180 secs, after: 0.8 secs.

Those runs were without the fix in dotnet/roslyn#66876 however. In .NET 8 builds that include dotnet/roslyn#66876, there shouldn't be a performance issue iterating a ChildSyntaxList in reverse order.

@cston cston marked this pull request as ready for review March 16, 2023 00:29
foreach (var child in node.ChildNodesAndTokens().Reverse())
var childNodesAndTokens = node.ChildNodesAndTokens();

// Avoid performance issue (in .NET 7 and earlier) iterating the child list in reverse
Copy link
Member

Choose a reason for hiding this comment

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

How does this relate to ".NET 7"? Is this actually about the version of Roslyn that's being used?

Copy link
Member Author

@cston cston Mar 16, 2023

Choose a reason for hiding this comment

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

Yes, this comment is about the version of Roslyn that's used.

Perhaps this should be: "Avoid performance issue in earlier implementations of ChildSyntaxList iterating the child list in reverse ..."

Copy link
Member

Choose a reason for hiding this comment

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

I see. You could just be explicit and include a link to the Roslyn PR that fixed it. Essentially we're saying if you're running with an earlier Roslyn than that, you could have perf issues. I'm just questioning the original wording because you will likely end up getting that fix as part of .NET 7 SDK updates and as part of VS updates, right?

@tarekgh
Copy link
Member

tarekgh commented Mar 16, 2023

cc @eiriktsarpalis

@cston cston merged commit 0b03ca6 into dotnet:main Mar 21, 2023
103 of 107 checks passed
@cston cston deleted the 66475 branch March 21, 2023 00:08
@ericstj
Copy link
Member

ericstj commented Mar 21, 2023

/backport to release/7.0

@ericstj
Copy link
Member

ericstj commented Mar 21, 2023

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/4483155231

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/4483155981

@dotnet dotnet locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants