-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Reduce allocations in DeclarationComputer #79782
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 DeclarationComputer #79782
Conversation
This is a draft until I get back numbers from a speedometer run. CSharpDeclarationComputer.ComputeDeclarations shows up as 1.0% of Roslyn OOP allocations during a completion scenario in the RazorEditingTests.CompletionInCohosting speedometer test. The majority of the allocations under this method appear to be linq related, so switching to the model where we use a pooled collection to collect the items rather than linq enumerables.
…e more obvious after looking at a test run with changes from the first commit
|
@dotnet/roslyn-compiler -- ptal |
jcouv
left a comment
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.
LGTM Thanks (commit 2)
|
@dotnet/roslyn-compiler for second review. Thanks |
| var codeBlocks = ImmutableArray<SyntaxNode>.Empty; | ||
| if (executableCodeBlocks != null) | ||
| { | ||
| executableCodeBlocks.RemoveAll(c => c == null); |
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.
might be nicer to use AddIfNotNull at the callsites, so taht there can't be nulls in here in the first place. #Resolved
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.
Looked into it, and there are quite a few callers, so I don't think I want to mess with that in this PR.
CSharpDeclarationComputer.ComputeDeclarations shows up as 1.0% of Roslyn OOP allocations during a completion scenario in the RazorEditingTests.CompletionInCohosting speedometer test. The majority of the allocations under this method appear to be linq related, so switching to the model where we use a pooled collection to collect the items rather than linq enumerables.
Test insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/659161
*** Before this change ***

*** With this change ***
