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

Reduce allocations in AbstractAsynchronousTaggerProvider.ComputeDifference #75639

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Oct 25, 2024

This method is showing up in a speedometer typing profile I'm looking at. This method computes the difference between two TagSpanIntervalTrees given an updated snapshot.

To do so, it currently creates a new heap allocated TagSpan for each item in both given interval trees. However, it need not do that, as that generated TagSpan isn't passed out of this method. Instead, TagSpanIntervalTree now has an AddAllSpans method that populates to a collection of value tuples, which ComputeDifference can now use.

This doesn't save a ton of allocations, but it's fairly simple and contained. The amount of allocations reduced by this change varies from 0.1% to 0.5% in a typing scenario I'm looking at depending on the profile.

*** allocations that are removed from the worse of the profiles of a typing scenarios in a speedometer test ***
image

…rence

This method is showing up in a scrolling and typing profile I'm looking at. This method computes the difference between two TagSpanIntervalTrees given an updated snapshot.

To do so, it currently creates a new heap allocated TagSpan for each item in both given interval trees. However, it need not do that, as that TagSpan isn't passed out of this method. Instead, TagSpanIntervalTree now has an AddAllSpans method that populates to a collection of value tuples, which ComputeDifference can now use.
@ToddGrun ToddGrun requested a review from a team as a code owner October 25, 2024 23:48
@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 25, 2024
@ToddGrun
Copy link
Contributor Author

@dotnet/roslyn-ide ptal

1 similar comment
@ToddGrun
Copy link
Contributor Author

ToddGrun commented Nov 4, 2024

@dotnet/roslyn-ide ptal

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