Skip to content

Reduce LOH allocations in MetadataWriter #78245

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

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Apr 22, 2025

MetadataWriter's use of Dictionary leads to LOH allocations in the Roslyn CA process. Instead, switch over to SegmentedDictionary to reduce that pressure.

From the Roslyn C# completion speedometer test, about 16% of all LOH allocations occur adding to MetadataWriter._signatureIndex. This type represents the 2nd highest entry on the LOH list.

image

After changing to a SegmentedDictionary these LOH are no longer present.

image

In draft mode until test insertion perf numbers come back

Will add justification if the perf numbers come back good
@ghost ghost added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 22, 2025
@ToddGrun ToddGrun changed the title WIP: Reduce LOH allocations in MetadataWriter Reduce LOH allocations in MetadataWriter Apr 22, 2025
@ToddGrun ToddGrun marked this pull request as ready for review April 22, 2025 13:38
@ToddGrun ToddGrun requested a review from a team as a code owner April 22, 2025 13:38
Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers 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.

3 participants