Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

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

Merged
ToddGrun merged 1 commit into
mainfrom
dev/toddgrun/ReduceApiMapAllocations
Jul 6, 2023
Merged

ToddGrun merged 1 commit into
mainfrom
dev/toddgrun/ReduceApiMapAllocations

Conversation

@ToddGrun

@ToddGrun ToddGrun commented Jul 5, 2023

Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants