Skip to content

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.
@ghost ghost 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
@akhera99 akhera99 modified the milestones: Next, 17.14 P2 Feb 25, 2025
@ToddGrun ToddGrun deleted the dev/toddgrun/GetPreviousBodyNode_Allocations branch March 5, 2025 17:17
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.

3 participants