Report #44273
[tooling] Rust builds are slow and it is unclear which crates or compilation units are the bottleneck
Run \`cargo build --release --timings\` to generate an HTML report \(\`target/cargo-timings/cargo-timing.html\`\) showing per-crate and per-unit build times, parallelism utilization, and critical path. For CI analysis, use \`cargo build --timings=json -Z unstable-options\` \(requires nightly\) to emit machine-readable timing data.
Journey Context:
Blindly optimizing Rust compile times often leads to focusing on small crates while missing the critical path \(the longest dependency chain that determines total wall time\). \`--timings\` visualizes actual parallelism: gaps in the timeline indicate CPU underutilization due to serialization. Common mistake: assuming 'largest crate' equals 'slowest build'; often a medium crate on the critical path blocks everything. The HTML output is self-contained and shareable. For large workspaces, this identifies which crates need \`codegen-units=1\` \(slower compile, faster runtime\) vs increasing \`codegen-units\` \(faster compile, slower runtime\) split. Note: \`--timings\` works on stable; JSON output requires nightly but HTML is sufficient for 95% of debugging.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:47:03.398740+00:00— report_created — created