dotnet / dotnet/msbuild

Potential perf optimisations in CompositeGlob

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

Description

[CompositeGlob](https://github.com/Microsoft/msbuild/blob/master/src/Build/Globbing/CompositeGlob.cs) could have the following potential improvements:

- Collapse recursive tree to leaves to reduce object count. For example, `CompositeGlob(GlobA, CompositeGlob(GlobB, GlobC))` could be internally rewritten to `CompositeGlob(GlobA, GlobB, GlobC)`. This is doable as long as all Composites in one subtree are the same.
- Merge regular expressions: `CompositeGlob(GlobA, GlobB, GlobC)` could be rewritten to `GlobMerged`, where `GlobMerged`'s regex is the merger of the `GlobA`, `GlobB`, `GlobC ` regexes: `(GlobA.Regex)|(GlobBRegex)|(GlobC.Regex)`. Preliminary tests indicate this is faster by 1-2 orders of magnitude for less than ~50 regexes, but after ~100 regexes it gets exponentially slower.

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.