Skip to content

perf(rust): stop copying rlibs on every Windows build - #427

Merged
fortmarek merged 2 commits into
mainfrom
perf/windows-rlib-search
Nov 9, 2026
Merged

fortmarek merged 2 commits into
mainfrom
perf/windows-rlib-search

Conversation

@fortmarek

@fortmarek fortmarek commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Windows Rust builds did far more work than the cache could save:

  • Every Windows Rust compile copied each transitive rlib into a per-crate search directory. Uncached actions cleared and recreated that directory on every build. For the Once CLI graph, that is about 6,700 copies and about 11 GB of rlibs copied, hashed, and stored again on every build. The uncached actions also made every target report bypass, so no target could reuse its build receipt.
  • Rlibs now resolve from their own output directories, as on other hosts. They are already declared inputs of each compile. Proc-macro DLLs keep their staging directory, because MSVC writes sibling files next to them.
  • The once workflow's Windows release graph build signed in to Tuist only after resolving the bootstrap, so the bootstrap always fell back to a Cargo build. It now selects the cache first, as the release workflow does.

Measurements

release graph build (windows-latest) Job total Bootstrap Once build Once build cache state
Before, main at the same tree as the warm #426 run 19.5 min 12.0 min (Cargo) 4.7 min bypass
After, first run (every Windows compile key changed) 29.2 min 5.7 min (built with Once) 21.5 min (cold) miss
After, rerun with no change 8.9 min 4.7 min (built with Once) 2.8 min hit

The bootstrap still reports bypass: the latest released Once builds it with its own embedded prelude, which still stages rlib copies. The first release that includes this change removes those copies from the bootstrap too.

ampagent and others added 2 commits November 9, 2026 16:20
Every Windows Rust compile copied each transitive rlib into a per-crate
search directory, rebuilt by uncached actions on every build. For the Once
CLI graph that is about 6,700 copies and 11 GB that are copied, hashed, and
stored again on every build, and the uncached actions keep each target
from reusing its build receipt.

Only proc-macro DLLs need a staging directory, because MSVC writes sibling
files next to them. Rlibs are already declared inputs of each compile, so
pointing rustc at their own directories, as on other hosts, is enough.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bfcc-5807-76c0-92bc-c557bc3b66a7
Co-authored-by: Marek Fort <marek@tuist.dev>
The release graph build resolved its bootstrap before signing in to Tuist,
so the bootstrap always fell back to a Cargo build. Select the cache first,
as the release workflow does.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bfcc-5807-76c0-92bc-c557bc3b66a7
Co-authored-by: Marek Fort <marek@tuist.dev>
@fortmarek
fortmarek marked this pull request as ready for review November 9, 2026 17:54
@fortmarek
fortmarek merged commit f7f06be into main Nov 9, 2026
58 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants