Skip to content

Conversation

@YuliiaKovalova
Copy link
Member

Reverts #12159

Confirmed with @Erarndt , it causes extra allocations in VS.

Copilot AI review requested due to automatic review settings August 26, 2025 17:12
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 reverts a previous optimization that attempted to reduce allocations by pre-sizing dictionaries in MSBuild's item collection system. The revert is necessary because the optimization was found to cause extra allocations in Visual Studio, contradicting its intended purpose.

Key changes:

  • Removes capacity pre-allocation methods and their usage from item dictionary classes
  • Simplifies property implementations by removing thread-safe wrappers where they were added for capacity tracking
  • Eliminates EnsureCapacity calls from task execution and batching workflows

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Build/Collections/ItemDictionary.cs Removes Count/ItemTypesCount properties with locking and EnsureCapacity method
src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Removes EnsureCapacity calls before processing task outputs
src/Build/BackEnd/Components/RequestBuilder/Lookup.cs Removes EnsureCapacity method and capacity-based constructor usage
src/Build/BackEnd/Components/RequestBuilder/BatchingEngine.cs Removes EnsureCapacity call before adding items to buckets

@YuliiaKovalova YuliiaKovalova enabled auto-merge (squash) August 26, 2025 17:24
@YuliiaKovalova YuliiaKovalova merged commit 35f09c0 into main Aug 26, 2025
9 checks passed
@YuliiaKovalova YuliiaKovalova deleted the revert-12159-dev/erarndt/dictResizing branch August 26, 2025 17:59
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