Skip to content
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

Merged
merged 1 commit into from
Jun 17, 2021

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Jun 16, 2021

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.

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
@333fred
Copy link
Member

333fred commented Jun 17, 2021

@dotnet/roslyn-compiler for a second review

@sharwell sharwell merged commit 0983302 into dotnet:main Jun 17, 2021
@ghost ghost added this to the Next milestone Jun 17, 2021
@sharwell sharwell deleted the faster-cache branch June 17, 2021 23:07
{
public static bool TryAdd<T>(
this ImmutableSegmentedDictionary<T, VoidResult>.Builder dictionary,
T value)
Copy link
Contributor

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'?

Copy link
Member Author

@sharwell sharwell Jun 17, 2021

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.

@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants