dotnet / dotnet/msbuild

Use Span-based path manipulation

Open
#6,977 12 comments 0 reactions 0 assignees View on GitHub
Area: Performance triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 6h
Merged PRs (30d)
139

Description

MSBuild still uses the old string-based path manipulation almost everywhere, which leads to avoidable allocations in cases where the result of e.g. `Path.GetFileName()` is not stored on the heap.

Here's one example use of `Path.GetFileName()` which could be easily converted to Span:

https://github.com/dotnet/msbuild/blob/356825cf62bb36ebd215572c8b7e7eabc88ca7fc/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs#L293

but there are many more, for other `Path` APIs as well as for helpers implemented in the MSBuild codebase. Some of them are trivial to fix, some will require deeper changes.

Note that the new Span-based public surface is available in the Microsoft.IO.Redist package on .NET Framework under the namespace `Microsoft.IO` instead of `System.IO`.

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.