Skip to content

Conversation

@ToddGrun
Copy link
Contributor

This method showed up when investigating a recent regression in allocations due to a change in lightbulb behaviors. Although this method hasn't changed recently, it is one of the easiest ways to claw back some memory during this scenario.

Locally, opening the vs-platform solution with this change reduces allocations under GetAnalyzerTypeNameMap from about 1.9% (63 MB) to about 0.1% (5 MB)

*** previous allocations during vs-platform solution open ***
image

*** allocations with these changes during vs-platform solution open ***
image

This method showed up when investigating a recent regression in allocations due to a change in lightbulb behaviors. Although this method hasn't changed recently, it is one of the easiest ways to claw back some memory during this scenario.

Locally, opening the vs-platform solution with this change reduces allocations under GetAnalyzerTypeNameMap from about 1.9% (63 MB) to about 0.1% (5 MB)
@ToddGrun ToddGrun requested a review from a team as a code owner July 16, 2024 23:52
@ghost ghost added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 16, 2024
group typeName by supportedLanguage;

return typeNameMap.ToImmutableSortedDictionary(g => g.Key, g => g.ToImmutableHashSet(), StringComparer.OrdinalIgnoreCase);
Dictionary<string, ImmutableHashSet<string>.Builder> typeNameMap = new Dictionary<string, ImmutableHashSet<string>.Builder>(StringComparer.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use ImmutableSegmentedHashSet instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see these hitting the LOH in the profile that I looked at, so I'd prefer to keep as-is, without that evidence to back up such a change.

@ToddGrun
Copy link
Contributor Author

@dotnet/roslyn-compiler -- ptal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants