-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 CSharpSyntaxFacts.AppendMembers (again) #74790
Reduce allocations in CSharpSyntaxFacts.AppendMembers (again) #74790
Conversation
A recent change(dotnet#74596) modified this code to take in an ArrayBuilder to allow callers to easily use pooled arrays. However, the size of the data populated into those arrays commonly exceeds the ArrayBuilder reuse threshold, those reducing the allocation benefit realized in those codepaths. This PR changes the callers to instead use a pooled list, thus avoiding the threshold issue. Current scrolling speedometer results for the typing scenario still show this as allocating around 35 MB (which was about 3.5% at the time of the earlier PR). My hope is that this PR will get rid of nearly all those allocations this time.
@ToddGrun were you going to run a smoke test for this one? |
Yeah, I was going to post once the PR was created, but here's the pipeline run that will be generating the PR shortly: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=10060803&view=results Update: Numbers look a bit wonky to me. Going to make a tweak and re-run the process. |
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 changes LGTM.
…*, this will finally get the allocation reductions, as having each caller own what pool they use was giving me grief.
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.
Compilers changes LGTM
Did multiple insertion PRs after the last commit, all looks good now. The full 3.5% of SyntaxNode[] allocations look to be gone. https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/573228 |
A recent change(#74596) modified this code to take in an ArrayBuilder to allow callers to easily use pooled arrays. However, the size of the data populated into those arrays commonly exceeds the ArrayBuilder reuse threshold, those reducing the allocation benefit realized in those codepaths.
This PR changes the callers to instead use a pooled list, thus avoiding the threshold issue. Current scrolling speedometer results for the typing scenario still show this as allocating around 35 MB (which was about 3.5% at the time of the earlier PR, about 4.6% of allocations currently). My hope is that this PR will get rid of nearly all those allocations this time.
*** relevant allocations from the typing scenario in the scrolling speedometer ***