Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

Removes 60MB of allocs in a simple typing/lightbulb scenario. This is 1.5% of all allocs in that scenario:

image

After this change, this allocation is gone.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 30, 2023 20:56
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 30, 2023
var uniqueSymbols = PooledHashSet<ISymbol>.GetInstance();
try
using var _ = PooledHashSet<ISymbol>.GetInstance(out var uniqueSymbols);

Copy link
Member Author

Choose a reason for hiding this comment

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

read with whitespace off.

@CyrusNajmabadi CyrusNajmabadi requested a review from genlu March 30, 2023 21:08
#endif

uniqueSymbols.AddRange(_reachingWrites.Keys);
uniqueSymbols.AddRange(other._reachingWrites.Keys);
Copy link
Contributor

Choose a reason for hiding this comment

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

uniqueSymbols.AddRange(other._reachingWrites.Keys);

Couldn't this just use Overlaps to see if they share any keys?

Copy link
Member Author

Choose a reason for hiding this comment

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

i'll look to see :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Going to sign off per our offline conversation. If Overlaps wouldn't suffer from the same allocation issue, then it seems like uniqueSymbols isn't needed.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 3939b64 into dotnet:main Mar 31, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the avoidEnumeratorAllocs branch March 31, 2023 01:32
@ghost ghost added this to the Next milestone Mar 31, 2023
@dibarbet dibarbet modified the milestones: Next, 17.7 P1 Apr 25, 2023
@mavasani mavasani added the Performance-Scenario-Diagnostics This issue affects diagnostics computation performance for lightbulb, background analysis, tagger. label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Performance-Scenario-Diagnostics This issue affects diagnostics computation performance for lightbulb, background analysis, tagger. 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