Skip to content

Streamline BuildGlobResultFromIncludeItem#12178

Merged
SimaTian merged 4 commits intodotnet:mainfrom
Erarndt:dev/erarndt/buildGlob
Sep 26, 2025
Merged

Streamline BuildGlobResultFromIncludeItem#12178
SimaTian merged 4 commits intodotnet:mainfrom
Erarndt:dev/erarndt/buildGlob

Conversation

@Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Jul 15, 2025

Fixes #

Context

There are some easy allocation wins in BuildGlobResultFromIncludeItem(), and the highlighted lines can either be reduced or removed:

image

Here is the method after changes:

image

Changes Made

Testing

Notes

Copilot AI review requested due to automatic review settings July 15, 2025 21:55
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 optimizes the BuildGlobResultFromIncludeItem method to reduce memory allocations by replacing LINQ operations with more efficient manual iteration and array initialization patterns.

  • Replaces LINQ Where().ToArray() with manual foreach loop and lazy list initialization
  • Replaces LINQ Select().ToImmutableArray() with direct array allocation and population
  • Maintains the same filtering logic while improving performance characteristics

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.

4 participants