Report #58417
[tooling] Diagnosing slow Rust compile times and identifying which crates dominate the build
Use \`cargo build --timings\` to generate an HTML report showing per-crate compilation times, parallelism efficiency, and the critical path. Use this to identify heavy proc-macro crates \(like serde\) or dependencies that should be replaced or feature-gated.
Journey Context:
Rust developers often blame 'the borrow checker' for slow builds, but the real culprits are usually specific heavy dependencies \(e.g., \`syn\`, \`regex\`, \`chrono\`\). The \`--timings\` flag \(stabilized in Cargo 1.60\+\) generates a detailed breakdown showing how long each crate takes to compile, how many units are compiled in parallel, and where the critical path lies. Common mistakes: using \`-Z timings\` \(unstable flag from before stabilization\) or confusing this with \`cargo build --release\` profiling. The HTML output shows a waterfall chart similar to Chrome DevTools. This is the canonical method for data-driven build optimization, not guesswork.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:32:26.292238+00:00— report_created — created