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

Short-circuit tagger usage of interval tree when tagging complete snapshot #70285

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Oct 7, 2023

Noticed when looking at CPU usage on prism for completion scenario. It looks like the primary culprit that I saw when debugging locally was outlining (TTag was IStructureTag2). I was seeing requests spanning the full snapshot with ~2000 entries in spansToInvalidate when editing in the languageparser.cs file in the Roslyn sln. The Except call would end up creating a 2000 entry set, and proceed to remove all 2000 entries from it.

Fixes AB#1897704

…pshot

Noticed when looking at CPU usage on prism for completion scenario. It looks like the primary culprit that I saw when debugging locally was outlining (TTag was IStructureTag2). I was seeing requests spanning the full snapshot with ~2000 entries in spansToInvalidate when editing in the languageparser.cs file in the Roslyn sln. The Except call would end up creating a 2000 entry set, and proceed to remove all 2000 entries from it.

Addresses https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1897704
@ToddGrun ToddGrun requested a review from a team as a code owner October 7, 2023 01:23
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 7, 2023
// Performance: No need to fully realize spansToInvalidate or do any of the calculations below if the
// full snapshot is being invalidated.
if (firstSpanToInvalidate.Length == firstSpanToInvalidate.Snapshot.Length)
return Array.Empty<ITagSpan<TTag>>();
Copy link
Member

Choose a reason for hiding this comment

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

fascinating. do we know why the entire span is being invalidated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I can see, very few of the Roslyn taggers override GetSpansToTag

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

I'd like to discuss this on monday.

@ToddGrun
Copy link
Contributor Author

@ToddGrun ToddGrun merged commit f461d4c into dotnet:main Oct 12, 2023
24 checks passed
@ghost ghost added this to the Next milestone Oct 12, 2023
@jjonescz jjonescz modified the milestones: Next, 17.9 P1 Oct 31, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants