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 allocations #4892

Merged
merged 4 commits into from
Feb 25, 2021
Merged

Reduce allocations #4892

merged 4 commits into from
Feb 25, 2021

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Feb 23, 2021

Reduce hot path allocations.

Fixes #4893

@sharwell sharwell requested a review from a team as a code owner February 23, 2021 20:51
@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #4892 (c87e07f) into master (5cb1676) will decrease coverage by 0.01%.
The diff coverage is 87.17%.

@@            Coverage Diff             @@
##           master    #4892      +/-   ##
==========================================
- Coverage   95.65%   95.64%   -0.02%     
==========================================
  Files        1183     1184       +1     
  Lines      270513   270536      +23     
  Branches    16334    16341       +7     
==========================================
- Hits       258763   258744      -19     
- Misses       9653     9673      +20     
- Partials     2097     2119      +22     

Comment on lines +12 to +13
<!-- Work around PerformanceSensitiveAttribute.cs cannot resolve ValueTask<TResult>. -->
<NoWarn>$(NoWarn);CS1574</NoWarn>
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 Submitted #4895 as a draft to remove all these as soon as this PR is published

}

PostProcessArgument(argumentOperation, isEscaped);
_pendingArgumentsToPostProcess.Remove(argumentOperation);
Copy link
Member Author

Choose a reason for hiding this comment

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

@mavasani In order to use the ExtractAll method (which has clear semantics), I needed to hoist this call to Remove outside the foreach (where it combined with the Where method). Considering there is no other code that checks _pendingArgumentsToPostProcess.Contains, it seemed like a safe change.

@sharwell sharwell merged commit 256d65a into dotnet:master Feb 25, 2021
@sharwell sharwell deleted the reduce-allocs branch February 25, 2021 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WellKnownTypeProvider.TryGetOrCreateTypeByMetadataName allocates even when already cached
3 participants