-
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
Use segmented collection for faster declaration cache #54146
Conversation
src/Compilers/Core/Portable/Collections/DictionaryExtensions.cs
Outdated
Show resolved
Hide resolved
Ideally ImmutableSegmentedHashSet<string> would be used, but this type is not currently available. As an interim solution, ImmutableSegmentedDictionary<string, VoidResult> is used as a set. See https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1343268
@dotnet/roslyn-compiler for a second review |
{ | ||
public static bool TryAdd<T>( | ||
this ImmutableSegmentedDictionary<T, VoidResult>.Builder dictionary, | ||
T value) |
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.
Would it be appropriate to name this parameter 'key'?
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.
This is specifically implemented for treating a dictionary with VoidResult
values as a set. The name could go either way, but hopefully a proper set type replaces this in the future.
Ideally
ImmutableSegmentedHashSet<string>
would be used, but this type is not currently available. As an interim solution,ImmutableSegmentedDictionary<string, VoidResult>
is used as a set.This addresses 10-20% of the allocation load in AB#1343268, where GC is a significant contributor to slowness.