Skip to content

perf(dev): share Rust builds with sccache - #198

Closed
johnmatthewtennant wants to merge 1 commit into
jtennant/per-worktree-cargo-targetsfrom
jtennant/sccache-worktree-builds
Closed

perf(dev): share Rust builds with sccache#198
johnmatthewtennant wants to merge 1 commit into
jtennant/per-worktree-cargo-targetsfrom
jtennant/sccache-worktree-builds

Conversation

@johnmatthewtennant

@johnmatthewtennant johnmatthewtennant commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Worktree-local Cargo targets prevent concurrent builds from blocking, but each new worktree otherwise starts with a cold compiler cache.

This draft adds sccache to Berd’s Hermit environment and configures RUSTC_WRAPPER so cacheable compiler outputs use a user-level store while Cargo state remains isolated per worktree.

Findings

  • A cross-worktree probe produced 24 C, C++, or assembler cache hits but 0 Rust cache hits.
  • Rust compiler inputs retain worktree-specific absolute paths. SCCACHE_BASEDIRS does not normalize Rust inputs; upstream support remains open in mozilla/sccache#2652.
  • Giving Berd worktrees one stable CARGO_HOME fixes dependency source paths, but each workspace source root still differs.
  • The local APFS target-snapshot prototype reused all 59 crates in equivalent build, test --no-run, and check probes. Clippy reused all 58 dependencies and rechecked only the workspace crate.

Recommendation

Keep this PR as an experiment rather than merging it as Berd’s local worktree default. Revisit sccache when Rust path normalization is supported, or for CI and disposable compute where repositories can build at one stable absolute path.

Testing

  • Hermit provisioning test passes.
  • RUSTC_WRAPPER=sccache resolves to the pinned Hermit sccache 0.17.0.
  • Cross-worktree cache statistics were captured after clearing the sccache store and building equivalent fresh targets.

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.

1 participant