Repository navigation
ci: extract the node_modules cache in parallel parts - #345838
Merged
Merged
Conversation
Measures how long the PR runners take to extract the node_modules cache as one archive, as today, and as several parts extracted in parallel. To be removed before merging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent archive/extraction processes can corrupt recovery after a failure, and Windows pipelines can hide command failures, allowing incomplete restores to contaminate subsequent measurements.
2 open issues
What changed in this PR
This draft adds temporary benchmarks to evaluate whether parallel archive extraction can reduce node_modules cache restore time in VS Code’s PR checks. It does not yet change production cache handling.
Changes:
- Compare existing archives with weighted, multipart 7z and tar/zstd variants.
- Measure archive creation, extraction, size, and entry counts, and publish summary tables.
- Run benchmarks on Windows, Linux, and macOS PR runners after a cache hit.
| File | Description |
|---|---|
.github/workflows/node_modules_cache/bench.ts |
Implements archive splitting, parallel benchmarks, recovery, and result reporting. |
.github/workflows/bench-node-modules-cache.yml |
Adds cross-platform benchmark jobs, including Windows Dev Drive setup. |
Review effort: Balanced
One tar or 7-Zip process extracts the 173k files of the node_modules cache about twice as slowly as several in parallel. Split the archive into 8 parts of about the same extraction time, archive and extract them in parallel, and still extract the single archive of the caches saved before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ary) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On the Windows runners, extracting the node_modules cache into an empty folder took 64s as one 7-Zip archive and 27s as 8 parts in parallel. Linux went from 8.8s to 6.1s. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part of an effort to get the required PR checks under 10 minutes. Every test job restores the
node_modulescache, and today's restore step takes about 72s on Windows, 44s on macOS and 22s on Linux. Most of the Windows time is spent unpacking one ~1 GB 7z archive into ~175k files with a single 7-Zip process.Changes
cache.shandcache.ps1split thenode_modulesfile list into 8 parts (splitList.ts), which they archive and extract in parallel. Each part is a contiguous range of the list, weighted by size plus a per-file cost. Formats and flags are unchanged: tar+zstd-3on Linux and macOS, 7-Zip-mx3on Windows.extractstill restores the singlenode-modules.tzst/cache.7zof existing caches. Sobuild/.cachesaltis not bumped, and nothing gets invalidated. The new format takes effect whenpr-node-modules.ymlnext saves a cache, for example after the next dependency change onmain.listNodeModules.tsis unchanged, since the Azure pipelines use it too.Benchmark
The benchmark ran on the PR runners against the real
maincaches, using the temporary workflow in the earlier commits, which this PR now removes. Each variant extracted into an empty folder, as the PR jobs do. On macOS it extracted in place because the runner's disk is small.All variants restored the same number of entries (175,033 on Windows). Other variants measured on Windows:
Expected savings are about 37s per Windows job. The saving is part of every Windows job's setup, so it shortens the slowest jobs too. Linux and macOS save a few seconds. Archiving in parallel took ~97s on Windows, and only the cache-warming jobs on
mainarchive.Validation
node_modules, extract): the file and link listing is identical. Old single-archive caches still extract identically, and a missing archive fails.cache.sh/cache.ps1archive+extractrestored all entries on Linux, macOS and Windows (cache-scriptsrows of the benchmark).actionlintandeslintare clean.