Report #76895
[tooling] Rust build times are opaque and slow to optimize without visibility into crate-level parallelism
Use \`cargo build --timings\` to generate an HTML report \(\`target/cargo-timings/cargo-timing.html\`\) showing per-crate compilation duration, concurrency gaps, and the critical path, enabling targeted optimization of slow dependencies
Journey Context:
Blindly adding \`codegen-units=1\` or \`-j1\` often hurts performance. The \`--timings\` flag \(stabilized in Rust 1.60\) instruments the compiler to emit duration data for each crate. The resulting HTML visualization distinguishes between active compilation \(CPU usage\) and idle time waiting for dependencies \(gaps\), revealing whether the build is CPU-bound or dependency-graph-bound. This identifies candidates for \`sccache\` distributed compilation, dependency pruning, or splitting large crates. For CI pipelines, generate the report and archive it as an artifact to trend build time regressions. Note that this adds minor overhead \(<5%\) to the build itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:40:04.327316+00:00— report_created — created