Skip to content

perf(cli): parallelize multi-file analysis and harden release gates - #146

Merged
takeokunn merged 4 commits into
mainfrom
feat/rust-zero-cost-hardening
Aug 30, 2026
Merged

takeokunn merged 4 commits into
mainfrom
feat/rust-zero-cost-hardening

Conversation

@takeokunn

@takeokunn takeokunn commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Move multi-file CLI report analysis onto the shared analyze_files / analyze_files_raw path, using scoped workers and deterministic result ordering.
  • Keep small workloads serial and raise cache-validation parallelism only at the verified-safe threshold.
  • Rebase onto the current main, adapt callbacks to the owned-path API, and satisfy the current release verification gates without weakening tests or configuration.

Verification

  • nix develop -c cargo clippy --workspace --all-targets --all-features -- -D warnings
  • nix develop -c cargo fmt --all -- --check
  • git diff --check
  • Full pre-rebase release suite: 15,279 tests passed
  • Post-rebase flake evaluation selected 15,284 tests across 97 binaries
  • GitHub CI: flake evaluation, audit, actionlint, clippy, docs, integration, MSRV, nextest, and treefmt all passed
  • Two load-sensitive cost tests that failed in separate highly parallel local flake runs both passed when rerun exactly and in isolation

Benchmark gate evidence

The advisory benchmark job failed twice on non-overlapping benchmark families. A local control comparison using the identical commit (e4f2d1c5) on both sides also reported 8/36 regressions, up to +50.9%. This demonstrates fixed-order machine drift in the comparison harness rather than a code regression. The benchmark threshold, tests, and CI configuration were not weakened.

Notes

The two local full-flake attempts failed in different benchmark-style timing assertions under whole-suite parallel load. Each exact test passed immediately in isolation.

Migrate ~257 CLI report commands from a serial per-file read/parse/analyze
loop to the shared analyze_files/analyze_files_raw helper in
packages/core/cli/src/shared.rs, which schedules work across all cores via
std::thread::scope with a work-stealing atomic cursor (largest-file-first
claim order), falling back to a serial iterator below an 8-file threshold.

lint-* crates' report builders return LintError, and the package crate's
return PackageRefactorError, neither of which implements From<CliError> by
design (an intentional one-way layering boundary: core crates must not
depend on the CLI error type). Those ~245 files use analyze_files_raw, whose
closure owns its own read and converts errors via the existing one-way
From impl, instead of weakening that boundary.
…rmed-safe size

CI's benchmark gate caught a real regression: cache-dir/warm/128 (8
directories, right at the old PARALLEL_VALIDATION_THRESHOLD of 8) was ~37%
slower than the serial path, confirmed with a lower confidence bound of
+36.5% — thread-spawn overhead dominating a handful of single-syscall stat
checks. warm/1024 (64 directories) was genuinely ~28% faster, confirming the
parallel path pays off at that scale. Raise the threshold to 64, the larger
of the two confirmed points, rather than guess at the crossover between them.
@takeokunn
takeokunn force-pushed the feat/rust-zero-cost-hardening branch from b99443a to e4f2d1c Compare August 30, 2026 01:24
@takeokunn takeokunn changed the title perf(cli): parallelize multi-file report commands across all cores perf(cli): parallelize multi-file analysis and harden release gates Aug 30, 2026
@takeokunn
takeokunn merged commit 1af7996 into main Aug 30, 2026
18 of 20 checks passed
@takeokunn
takeokunn deleted the feat/rust-zero-cost-hardening branch August 30, 2026 02:40
takeokunn added a commit that referenced this pull request Sep 3, 2026
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