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

Don't box enumerators in ContentItemCollection #5269

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

drewnoakes
Copy link
Contributor

@drewnoakes drewnoakes commented Jun 22, 2023

Bug

Fixes: NuGet/Home#12689
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1837339

Regression? Last working version: N/A

Description

ContentItemCollection has many foreach operations over interfaces such as IEnumerable<>, IList<> and IDictionary<>. We can avoid boxing these enumerators via the NoAllocEnumerate() extension method.

See #5246 for more information on that extension method.

The allocation of these boxed enumerators was identified as a top contributor to GC pauses by GCPauseWatson.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

This class has many foreach operations over interfaces such as IEnumerable, IList and IDictionary. We can avoid boxing these enumerators via the NoAllocEnumerate extension method.

The allocation of these boxed enumerators was identified as a top contributor to GC pauses by GCPauseWatson.
@drewnoakes drewnoakes requested a review from a team as a code owner June 22, 2023 12:23
@nkolev92 nkolev92 merged commit 578eaf7 into dev Jun 28, 2023
@nkolev92 nkolev92 deleted the dev-drnoakes-boxed-enumerators branch June 28, 2023 20:30
@aortiz-msft aortiz-msft added the Community PRs created by someone not in the NuGet team label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ContentItemCollection.FindBestItemGroup boxing enumerator
3 participants