dotnet / dotnet/msbuild

[Performance]: Fuse sibling recursive globs during item evaluation

Open
#14,858 0 comments 0 reactions 0 assignees View on GitHub
Area: Evaluation Area: Performance Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Problem

`LazyItemEvaluator.IncludeOperation` expands each semicolon-separated `GlobFragment` independently, even when the globs share the same root and excludes. This repeats full directory-tree walks.

> Note: These are repeated logical traversals and matching passes. During normal project evaluation, the shared directory-entry cache usually avoids repeating the underlying physical OS directory enumeration.

For example:

```xml

```

MSBuild currently walks the same project tree once for `Assets\**`, again for `.props`, and again for `.targets`. The proposed optimization would walk the tree once and check all three patterns during that traversal.

Local OrchardCore metrics found 234 zero-result `**\*.props` requests and 234 zero-result `**\*.targets` requests. Removing those walks reduced glob time 71.5%, item-pass time 30.0%, and total evaluation 15.4%. #14663 optimizes each traversal but does not reduce their number.

### Goal

Prototype one traversal for compatible sibling recursive globs while preserving fragment order, duplicates, original-glob provenance, excludes, and dangerous-glob skip behavior. Validate with OrchardCore and ChangeWave 18.11 enabled.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at LazyItemEvaluator.IncludeOperation and trace how each GlobFragment is expanded, including excludes and dangerous-glob handling. Prototype a shared traversal for compatible sibling recursive globs while preserving fragment order, duplicates, provenance, excludes, and skip behavior. Validate the performance change with OrchardCore and ChangeWave 18.11 enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.