Skip to content

Conversation

@ttstanley
Copy link
Contributor

Fixes #

Context

Based on some traces there were some closures from a linq call without the right context. This caused extra allocations and this addresses it.

Changes Made

Instead of using linq to filter ites, just used a for loop to create a filtered list

Testing

Compared with ILSpy that there were less closures and allocations (DisplayName)
Before
image

After
image

Notes

Copilot AI review requested due to automatic review settings June 2, 2025 23:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses unnecessary closures and extra allocations by replacing a LINQ filter with an explicit for loop.

  • Replaces LINQ filtering with a for loop to reduce allocations.
  • Pre-allocates a result list to store filtered items.

@ttstanley ttstanley changed the title Users/tevinstanley/expanditemintoitems Remove closures from ExpandItemIntoItems Jun 2, 2025
Copy link
Member

@SimaTian SimaTian left a comment

Choose a reason for hiding this comment

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

LGTM, just please add the comment as we discussed.

@SimaTian SimaTian merged commit f07055a into dotnet:main Jun 9, 2025
10 checks passed
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.

3 participants