Improve performance by parallelizing installation of packages
- Dominant language
- C#
- Stars
- 4.2k
- Forks
- 778
- Avg merge
- 1h 15m
- Merged PRs (30d)
- 19
Description
# What You Are Seeing?
Cake builds have quite a lot of overhead increasing the build time.
Restoring packages can be a significant part of this.
For example, we use jetBrains dotCover and R# for code coverage and code inspection during build:
```
#tool "nuget:?package=JetBrains.dotCover.CommandLineTools"
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
```
Because we have a lot of projects (each having its own cake build script) it i not an option to specify the package version explicitly in each script. Updating all the scripts would take too much time and so far we never had issues with a new package version not working correctly.
Restoring a package takes about 1.5 seconds on my machine. This is with the package already being installed (no download from NuGet). The time-consuming part is checking for a new version (we have no version specified so cake has to check for new version each time).
### What is Expected?
I saw that the cake code is looping over the required packages and installs one at a time.
It looks like it would be very easy to parallelize the package installation.
'ScriptProcessor' could be changed to use 'Parallel.ForEach' instead of a 'foreach'. The only part which seams to be not thread safe is 'IToolLocator.RegisterFile' which could be protected with a 'lock'.
### What version of Cake are you using?
Latest dev branch
### Are you running on a 32 or 64 bit system?
x64
### What environment are you running on? Windows? Linux? Mac?
Windows 20H2
Contributor guide
Assessment
This issue has not been assessed yet.