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 during typing #75351

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Oct 2, 2024

During typing, various codepaths attempt to find the set of changes between two text images. Note that while this change will get rid of the allocations, I'm not certain it makes sense for that codepath to be getting executed so frequently and am following up elsewhere. This should reduce allocations in the profile that I'm looking at by around 1.4% during typing.

*** allocations from the typing scenario in the new csharp editing speedometer that should be alleviated **
image

During typing, various codepaths attempt to find the set of changes between two text images. Note that while this change will get rid of the allocations, I'm not certain it makes sense for that codepath to be getting executed so frequently and am following up elsewhere.
@ToddGrun ToddGrun requested review from a team as code owners October 2, 2024 19:13
@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 2, 2024
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Compiler change LGTM (commit 2)

@ToddGrun
Copy link
Contributor Author

ToddGrun commented Oct 3, 2024

@dotnet/roslyn-compiler for 2nd review

Comment on lines +27 to +29
var newChange = changesInNextVersion.Count == 1
? changesInNextVersion[0]
: TextChangeRange.Collapse(changesInNextVersion);
Copy link
Member

Choose a reason for hiding this comment

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

Should this optimization be moved inside TextChangeRange.Collapse itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, but that method has several usages in which the caller only has an IEnumerable. I instead chose to limit the changes to the caller that was showing up in the performance profile I was looking at.

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.

6 participants