-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
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.
There was a problem hiding this 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)
@dotnet/roslyn-compiler for 2nd review |
var newChange = changesInNextVersion.Count == 1 | ||
? changesInNextVersion[0] | ||
: TextChangeRange.Collapse(changesInNextVersion); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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 **