Skip to content

Conversation

@ToddGrun
Copy link

@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.

4 participants