Faster Rust builds: shared builders and smarter caching

Plan and findings · status as of 27 October 2026

In short. Our Rust services are rebuilt from scratch on every CI run, and developers build on machines of very different strength. The plan: send both developer and CI builds to a small fleet of strong "builder" machines, route each build to the machine that already has that project's cache warm, and fix a few cache settings that currently throw work away. Measured on real projects, most CI releases could drop from tens of minutes to a few minutes, and everyday rebuilds get several times faster, whichever cache tool we use.

1. The goal

2. Where we are today

14–46 minmedian CI release run, per repo (sample of 9 repos)
~720 hCI runner time per month, release workflow, those repos only
15%of that is nightly rebuilds of commits that had already built
7–26%of commits change no code at all, yet trigger a full release build

3. What is on the table

Benchmarked on four representative projects on one 28-core machine, plus 30 days of CI history. The first two charts are gains we get whichever cache tool we use.

Other measured gains

ChangeEffect
Pass the build directory as a flag instead of an environment variableCache reuse across build directories: 0% → 82–100%
Only run the dependency update when an upstream actually moved3–14 s saved on most builds, often more than the edit itself costs
Skip CI runs where neither code nor dependency versions changed7–26% of runs skipped outright; most of the 15% nightly rebuild time
Macro caching, test-result cachingSmall (under 1 s per crate; lib tests 2–42 s): not worth special machinery now

Cache tool: sccache vs Mr. Boxington (mbx)

mbx is a new Rust build cache aimed at many agents and worktrees on one machine. Same code, same dependency versions, each tool with its own empty cache, sccache with the fixes above.

sccachembx
Fresh build directory, warm cache50–95 s1.6–11 s
Three agents start fresh worktrees at once105–255 s10–80 s
Cold buildabout equal (mbx 5–30% faster)
Normal edit-and-rebuild loopthe same
First edit of a crate in a checkoutnormal+17–26 s, once
Caches build scripts, C code and final linksnoyes
Cache size per project1–3 GB5–11 GB
Maturity~9 years, widely used~2 months, mostly one author, fast-changing

Caveat: about 11 of our 63 build scripts write generated files into the source tree rather than Cargo's official output folder. mbx caches build scripts, so with its defaults those projects fail to build in a fresh checkout; with that one feature switched off they work, and the gains above still hold.

4. The design

Developer or CI job→ local code service picks a builder→ builder with the warmest cache→ binaries come back / get published

Choosing a builder

On each builder

Dependencies (rolling release)

CI

5. Steps and status

#StepStatus
0Research current builder, build tool and CI; measure four projects; mine CI and commit historydone
0bEvaluate and benchmark mbx against sccachedone
1Quick fixes: build directory as a flag, incremental on for dev builds, one directory per project on builders, memory-based admissionto do
1bUpstream-head cache; run the dependency update only when something movedto do
1cMake the 11 build scripts write to the official output folder; adopt mbx on builders (pinned version)proposed
2Web UI builds: fast debug mode, skip when unchangedto do
3Smarter routing: snapshot, earliest finish, home machines, preferred builderto do
4CI on the builder fleet; trial on one core service firstto do, needs agreement
5Shared upstream view across the fleet; push notifications to keep it freshlater
6Optional: cache test results; let CI reuse binaries a developer already builtlater

6. Risks

7. Open questions

8. Done vs pending

Done
  • Mapped the builder, build tool, code service and CI
  • Benchmarks on four projects; CI and commit history analysis
  • Dependency-refresh cost model
  • mbx evaluation and benchmark
  • Found one project currently broken by an upstream change, and the build-script issue
Pending
  • All implementation (steps 1–6)
  • Decisions on the open questions
  • Agreement on the CI change

Numbers are single runs on one machine and should be read as rough. CI durations include queue time. The "warm builder" CI figure is an estimate: two release targets rebuilt after a day of upstream changes, excluding queueing. Contains no credentials or internal addresses.