Report #65538
[tooling] Rust compilation is slow but unclear which crates or dependencies are the bottleneck
Run \`cargo build --timings\` \(or \`--timings=html\`\) to generate an HTML report showing per-crate compilation times and dependency graphs. Open \`target/cargo-timings/cargo-timing.html\` to identify slow crates and parallelism inefficiencies.
Journey Context:
Blind optimization attempts like adding more codegen units or switching linkers are ineffective without data on where time is spent. The \`--timings\` flag instruments the compiler to record when each crate starts/finishes compilation, generating a visual timeline \(HTML\) or JSON. This reveals: 1\) which dependencies are on the critical path, 2\) if parallel compilation is actually occurring \(gaps indicate serialization\), 3\) if proc-macros or build scripts are dominating compile times. It is the canonical method for build time profiling in Rust, superseding external tools like \`cargo-bloat\` for timing analysis \(which only shows binary size\). Use this before attempting any architectural changes to fix slow builds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:29:16.404585+00:00— report_created — created