-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Area: PerformancePriority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasebacklogtriaged
Description
Issue Description
When glob expansion runs in a target via ItemGroupIntrinsicTask
, it separately enumerates includes and excludes, then does the subtraction of their results. This may be prohibitively slow when excludes refer to large subdirectories.
Steps to Reproduce
<Project>
<Target Name="Build">
<ItemGroup>
<MyResources Include="**\*.png;**\*.jpg" Exclude="bin\**\*.*;obj\**\*.*" />
</ItemGroup>
<Message Text="MyResources.Count: @(MyResources->Count())" />
</Target>
</Project>
When evaluating the glob, there is no need to recurse into bin
or obj
at all. MSBuild can simply skip these directories when it enumerates all .png
and .jpg
files.
Data
An internal project is seeing >10 minutes spent running the ItemGroupIntrinsicTask
due to this issue.
Analysis
These are the problematic calls:
msbuild/src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupIntrinsicTask.cs
Lines 469 to 481 in 39e20dc
foreach (string excludeSplit in excludes) | |
{ | |
string[] excludeSplitFiles = EngineFileUtilities.GetFileListUnescaped( | |
Project.Directory, | |
excludeSplit, | |
loggingMechanism: LoggingContext, | |
excludeLocation: originalItem.ExcludeLocation); | |
foreach (string excludeSplitFile in excludeSplitFiles) | |
{ | |
excludesUnescapedForComparison.Add(excludeSplitFile.NormalizeForPathComparison()); | |
} | |
} |
Versions & Configurations
No response
Regression
- yes
- no
Regression Details
No response
Metadata
Metadata
Assignees
Labels
Area: PerformancePriority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasebacklogtriaged