Repository navigation
Mitts 0.3.5
Mitts 0.3.5 is a performance release for warm cache hits and for many checkouts of large workspaces. Profiling the warm no-op path showed the time was not filesystem work but serial toolchain probes, a full source scan on every run, re-hashing of every restored byte, and per-package path locks that cascaded through result keys. Each of those is fixed here.
Warm-hit path (f279d90, ce712b7, 65fb4da, de2b86e)
- Toolchain probes are cached on disk.
rustup which rustc,rustc -vVandrustc --print cfgran serially on every invocation; they now live under<cache>/toolchain/, keyed by the binary's identity and the rustup selection (RUSTUP_TOOLCHAIN,RUSTUP_HOME, settings and the nearestrust-toolchainfile). Rustup proxies are never cached. - Restored objects are trusted. A cache hit no longer re-hashes every restored artifact (one read of every byte, hundreds of MB for a mid-size workspace). Store objects are immutable and read-only;
MITTS_VERIFY_RESTORE=1restores the check. - The
env!scan is memoized per file. The scan that findsCARGO_MANIFEST_DIRreaders used to read every.rsof every local package on each run; it is now keyed by file length and mtime under<cache>/env_macros/. Adding, removing or editing files still invalidates it. - Scheduler wake-ups. One worker is woken per ready unit instead of all of them per completion; the registry index is listed once per process.
MITTS_CACHE_IO_BUDGEToverrides the number of concurrent cache readers.
Path locks scoped to the target (facf59f, 83cdf10, f497a92)
- A
CARGO_MANIFEST_DIRread in one example or test used to lock the whole package on its absolute path, and because dependents key on their dependencies' result keys, every unit downstream was rebuilt per checkout. Locks are now scoped by Cargo target layout (src/for the library, root file plus module directory for bins, tests, examples and benches). The publish-time leak scan remains the safety net. - The scan stops at nested packages and treats
env!(#x)insidequote!as interpolation, not a read. - Artifacts that embed their checkout path are published under a per-checkout key; once that is known, other checkouts no longer queue on the shared single-flight lock and build in parallel.
Store hardlinks (0d3c0d4, ef7fc6a, 0ffe678)
MITTS_STORE_HARDLINKSis a three-state policy. The default isauto: reflink where the filesystem supports it, otherwise a read-only hardlink to the store object, otherwise a copy. Linked files are never writable (0o444,0o555for executables); the target index rejects a link that gained write bits and restores it.MITTS_STORE_HARDLINKS=0keeps the old copy-only behaviour,1always links. On ext4 this removes multi-gigabyte byte copies from every warm hit of a large workspace.
Build scripts (a7ad705, f4c0298, 1254078, 857fbc0, 7435b66)
- Build scripts receive the full
CARGO_PKG_*metadata for both compile and run. - Executables a build script writes into
OUT_DIRkeep their exec bit in the store. - A package's library, unit tests and integration tests share one build-script run on a cold miss instead of each executing it.
- A cache entry that lost its directives is replaced on the next save.
[lints.cargo]is never forwarded to rustc (it producedE0602and made some workspaces unbuildable).
Measured
Warm single hit, Apple Silicon/APFS: semver 83 ms → 20 ms, ripgrep 250 ms → 60 ms. Fresh 12-checkout swarm on x86_64 Linux/ext4, v0.3.4 → 0.3.5: ratatui 7.0 s → 0.21 s, tokio 7.0 s → 0.16 s, rustls 3.2 s → 0.45 s, delta 34 s → 5.9 s, winnow 34 s → 5.1 s, bat 6.2 s → 2.1 s, axum 0.57 s → 0.08 s; actix-web, lsd and tokei did not build on 0.3.4 and do now (actix-web swarm 0.25 s). On XFS with reflink, ratatui (462 packages) warm single 0.22–0.49 s → 0.08 s, swarm 1.45 s → 0.22 s. Remaining swarm time in clap, xh, delta and winnow is real per-checkout compilation of test binaries that embed the checkout path.
Install or update:
cargo install mitts --version 0.3.5 --lockedFull history: v0.3.4...v0.3.5