Speed up cargo-mutants runs #274

Merged
natsukium merged 4 commits from mutants-speed into main 2026-09-13 14:57:25 +09:00
Owner

Speed up cargo-mutants runs: profile, jobs, mold, standard recipes.

Implements the effective parts of #273, each backed by same-scope
measurements on the 12-core / 62 GB dev machine (details in the
commit bodies):

  • [profile.mutants] (inherits = "test", debug = 0), selected via
    profile = "mutants" in .cargo/mutants.toml. Cold scratch build
    ~38s -> ~16s; single-crate incremental rebuild ~3.1s -> ~2.2s;
    test outcomes identical.
  • just mutants defaults to CARGO_MUTANTS_JOBS=4 (the mutants config
    schema rejects a jobs key). 18-mutant mixed set: -j1 3m49s, -j2
    2m32s, -j4 2m26s, -j8 3m18s (target-dir lock contention), so -j4 is
    the knee.
  • Linux dev shell links with mold via RUSTFLAGS (warm rebuild
    ~2.1s -> ~1.6s on top of the profile); builds outside the shell and
    macOS shells are untouched.
  • just mutants-pr (branch diff) and just mutants-shard n/8 make the
    PR and full-run invocations repeatable; test-strategy skill points at
    them.

Deliberately not done, with reasons: RAM disk (the reflinked scratch
copy is ~51 GB, larger than the 32 GB /dev/shm), sccache (sources
differ per mutant), timeout tuning (suite runs ~8s, auto timeout ~42s
is adequate), and --copy-target/--gitignore tuning (reflink copy is
~10s and the copied target dir warms the baseline build).

Speed up cargo-mutants runs: profile, jobs, mold, standard recipes. Implements the effective parts of #273, each backed by same-scope measurements on the 12-core / 62 GB dev machine (details in the commit bodies): - `[profile.mutants]` (`inherits = "test"`, `debug = 0`), selected via `profile = "mutants"` in `.cargo/mutants.toml`. Cold scratch build ~38s -> ~16s; single-crate incremental rebuild ~3.1s -> ~2.2s; test outcomes identical. - `just mutants` defaults to `CARGO_MUTANTS_JOBS=4` (the mutants config schema rejects a `jobs` key). 18-mutant mixed set: -j1 3m49s, -j2 2m32s, -j4 2m26s, -j8 3m18s (target-dir lock contention), so -j4 is the knee. - Linux dev shell links with mold via RUSTFLAGS (warm rebuild ~2.1s -> ~1.6s on top of the profile); builds outside the shell and macOS shells are untouched. - `just mutants-pr` (branch diff) and `just mutants-shard n/8` make the PR and full-run invocations repeatable; test-strategy skill points at them. Deliberately not done, with reasons: RAM disk (the reflinked scratch copy is ~51 GB, larger than the 32 GB /dev/shm), sccache (sources differ per mutant), timeout tuning (suite runs ~8s, auto timeout ~42s is adequate), and `--copy-target`/`--gitignore` tuning (reflink copy is ~10s and the copied target dir warms the baseline build).
Every mutant pays a rebuild plus a relink, so the test profile's
debuginfo taxes all 5161 mutants. A dedicated profile inheriting
test with debug info off cuts the cold scratch build from ~38s to
~16s and the single-crate incremental rebuild from ~3.1s to ~2.2s,
with identical codegen and test outcomes (1374 passed either way).
cargo-mutants selects it via the profile key in mutants.toml;
declaring the profile alone changes nothing until selected.

Assisted-by: Pi Coding Agent:Muse Spark 1.3
At -j1 the 12-core dev machine idles through each mutant's mostly
serial single-crate rebuild, while -j8 regresses on target-dir lock
contention (85s+ stalled builds). On an 18-mutant mixed set: -j1
3m49s, -j2 2m32s, -j4 2m26s, -j8 3m18s, so four jobs is the knee.
The mutants config schema rejects a jobs key, so the default lives
in the recipes via CARGO_MUTANTS_JOBS (still overridable) instead.
mutants-pr scopes a run to the branch diff and mutants-shard to one
shard of the full sweep, making both standard invocations
repeatable.

Assisted-by: Pi Coding Agent:Muse Spark 1.3
With debuginfo gone the link dominates the per-mutant rebuild, and
mold cuts the warm single-crate rebuild from ~2.1s to ~1.6s on top
of the mutants profile, multiplying across all 5161 mutants. Wired
through the Linux dev shell's RUSTFLAGS rather than
.cargo/config.toml, so builds outside the shell keep the default
linker and macOS shells are untouched.

Assisted-by: Pi Coding Agent:Muse Spark 1.3
skills: document the standard mutants invocations
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
bench / Criterion regression gate (pull_request) Failing after 2m33s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m4s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m31s
pr / wire schema is compatible with the base (pull_request) Successful in 9s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 2m47s
pr / publish felis (x86_64-linux) (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 3s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 3m51s
darwin / detect relevant changes (pull_request) Successful in 3s
darwin / darwin docs-only no-op (pull_request) Has been skipped
pr / nix flake check (pull_request) Successful in 1m3s
darwin / build felis (aarch64-darwin) (pull_request) Successful in 2m8s
windows / cargo clippy (Windows cross) (pull_request) Successful in 14s
windows / frontend smoke (Windows) (pull_request) Successful in 1m34s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
9d2ab629bb
The just recipes now define the PR (mutants-pr) and full-sweep
(mutants-shard) workflow, built under the mutants profile with four
jobs by default; point the test-strategy skill at them so agents
stop hand-rolling flags.

Assisted-by: Pi Coding Agent:Muse Spark 1.3
natsukium deleted branch mutants-speed 2026-09-13 14:57:25 +09:00
natsukium referenced this pull request from a commit 2026-09-13 14:57:26 +09:00
Sign in to join this conversation.
No description provided.