-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Avoid allocating enumerators in symbol usage analysis #67582
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
Avoid allocating enumerators in symbol usage analysis #67582
Conversation
| var uniqueSymbols = PooledHashSet<ISymbol>.GetInstance(); | ||
| try | ||
| using var _ = PooledHashSet<ISymbol>.GetInstance(out var uniqueSymbols); | ||
|
|
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.
read with whitespace off.
| #endif | ||
|
|
||
| uniqueSymbols.AddRange(_reachingWrites.Keys); | ||
| uniqueSymbols.AddRange(other._reachingWrites.Keys); |
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.
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'll look to see :)
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.
Going to sign off per our offline conversation. If Overlaps wouldn't suffer from the same allocation issue, then it seems like uniqueSymbols isn't needed.
ToddGrun
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.
![]()
Removes 60MB of allocs in a simple typing/lightbulb scenario. This is 1.5% of all allocs in that scenario:
After this change, this allocation is gone.