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

Realize less of the syntax tree during AbstractSemanticModelReuseLanguageService.GetPreviousBodyNode #77032

Merged

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Feb 4, 2025

During the typing scenario in the scrolling speedometer test, about 13% of allocations in VS are under GetPreviousBodyNode, due to realizing a bunch of nodes in the syntax tree to attempt to map from a method node in one tree to the corresponding node in similarly structured tree. Instead, as we know the trees have similar structure, just walk up the ancestors in the current tree to generate a node index path, and apply that path to the previous tree to find the appropriate method node.

*** Without change ***
13% of VS allocations during typing:
image

Types allocated under GetPreviousBodyNode:
image

*** With change ***
0.3% of VS allocations during typing:
image

Types allocated under GetPreviousBodyNode:
image

…eLanguageService.GetPreviousBodyNode

This is in a draft PR while speedometer tests determine if this has the desired effect.

During the typing scenario in the scrolling speedometer test, about 13% of allocations are under GetPreviousBodyNode, due to realizing a bunch of nodes in the syntax tree to attempt to map from a method node in one tree to the corresponding node in similarly structured tree. Instead, as we know the trees have similar structure, just walk up the ancestors in the current tree to generate a node index path, and apply that path to the previous tree to find the appropriate method node.
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 4, 2025
@ToddGrun
Copy link
Contributor Author

ToddGrun commented Feb 5, 2025

VS test insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/608266

Results look surprisingly good, going to raise out of draft status. Allocations under AbstractSemanticModelReuseLanguageService.GetPreviousBodyNode went from ~13% to 0.3%, with basically only the ClassDeclarationSyntax type allocations remaining under that stack.

@ToddGrun ToddGrun changed the title WIP: Realize less of the syntax tree during AbstractSemanticModelReuseLanguageService.GetPreviousBodyNode Realize less of the syntax tree during AbstractSemanticModelReuseLanguageService.GetPreviousBodyNode Feb 5, 2025
@ToddGrun ToddGrun marked this pull request as ready for review February 5, 2025 13:41
@ToddGrun ToddGrun requested a review from a team as a code owner February 5, 2025 13:41
@ToddGrun ToddGrun merged commit 0ba72bd into dotnet:main Feb 5, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants