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

Reduce large memory allocations due to public api map construction. #6742

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Jul 5, 2023

On the profile I'm looking at, 11.4% of large object allocations are due to the ctor creation of the api map. There are two mitigations taken here:

  1. Pre-size the dictionary as it's size is known. (I see over 6000 entries in this dictionary when in Roslyn.sln)
  2. Defer creation of the api map as it's not needed on many of the code paths where this object is created. For example, just typing inside a method appears to create several instances of this object, but I never see the api map dereferenced during that period.

On the profile I'm looking at, 11.4% of large object allocations are due to the ctor creation of the api map. There are two mitigations taken here:

1) Pre-size the dictionary as it's size is known. (I see over 6000 entries in this dictionary when in Roslyn.sln)
2) Defer creation of the api map as it's not needed on many of the code paths where this object is created. For example, just typing inside a method appears to create several instances of this object, but I never see the api map dereferenced during that period.
@ToddGrun ToddGrun requested a review from a team as a code owner July 5, 2023 21:14
@ToddGrun ToddGrun merged commit 2bf6f36 into main Jul 6, 2023
@ToddGrun ToddGrun deleted the dev/toddgrun/ReduceApiMapAllocations branch July 6, 2023 18:11
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.

3 participants