dotnet / dotnet/msbuild

Item batching can be very slow, especially on Linux

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

Description

Changing an item include to include some additional metadata resulted in extreme slowdowns for me, especially on Linux:

OS | Without metadata | With metadata
---- | - | -
Windows | 10 ms | 8234 ms
Linux | 68 ms | 143022 ms

The change that caused this was changing from:

```xml
<_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" />
```

To:

```xml
<_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)"
DestinationSubPath="%(FileDefinitions.Path)" />
```

# Repro steps

- `git clone https://github.com/dsplaisted/msbuild-slow-batching`
- `cd msbuild-slow-batching`
- `cd TestApp`
- `dotnet build /clp:PerformanceSummary`
- Observe the difference in execution time between the FastBatching and SlowBatching targets in the performance summary

EXPECTED: Execution times are comparable
ACTUAL: SlowBatching execution time is several orders of magnitude slower than FastBatching

# Repro details

The repro project is an app targeting `netcoreapp1.1` referencing a library which targets `netstandard1.5`. The app project has the following targets added to it:

```xml














```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.