Skip to content

Conversation

@ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Apr 22, 2025

Remove some of the SyntaxNode.GetText callers that were calling this on a root node, and instead switch them over to use Document.GetValueTextAsync instead. Each SyntaxNode.GetText call builds up a new SourceText from scratch. Instead, if Document.GetValueTextAsync is used, there is the potential for sharing the sourcetext with other document consumers.

This shows up as about a 50MB allocation improvement in VS under AbstractMemberInsertingCompletionProvider.RemoveDestinationNodeAsync in the override completion commit scenario in the C# editing speedometer.

…rce text from the document

This is currently a draft mode PR until I can get back vs insertion speedometer numbers that corroborate the improvements I think this will have.

If that happens, I will elevate the PR out of draft mode and add the before/after performance characteristics.
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 22, 2025
@ToddGrun ToddGrun changed the title *** WIP: Convert SyntaxNode.GetText users to instead retrieve the source text from the document Convert SyntaxNode.GetText users to instead retrieve the source text from the document Apr 23, 2025
@ToddGrun ToddGrun marked this pull request as ready for review April 23, 2025 15:04
@ToddGrun ToddGrun requested a review from a team as a code owner April 23, 2025 15:04
@ToddGrun ToddGrun merged commit 1a8d44a into dotnet:main Apr 23, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 23, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 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.

3 participants