Disclaimer: If you didn't see my profile description. I am a biologist. I have some computer science background, but not coding. I am publishing some cargo crates and other little repos to (hopefully) meaningfully contribute to open-source projects (tactfully, I hope) and rust in general with any extra claude credits I have available. I am trying to ensure that any contributions I make are actually helpful so any criticism or feedback of my approach would be greatly appreciated.
A cargo subcommand that answers "why is my build slow?" by running cargo build with timing data and presenting results in plain English with actionable recommendations.
- Runs
cargo build --message-format=jsonto collect per-crate build durations - Ranks dependencies by compile time and shows the top N slowest
- Identifies proc-macro crates (which can't be parallelized well)
- Analyzes your
Cargo.tomlfeature flags for known heavy crates - Generates plain-English recommendations to speed up your build
- Color-coded terminal output for quick visual scanning
cargo install --path .# In your project directory:
cargo why-slow
# Show top 20 slowest crates:
cargo why-slow -n 20
# Analyze a release build:
cargo why-slow --release
# Analyze a project in a different directory:
cargo why-slow --path /path/to/project- Runs
cargo build --message-format=jsonto get structured build output - Parses
compiler-artifactJSON messages to extract crate names and compile durations - Identifies proc-macro crates by naming convention (
_derive,_macrossuffixes) - Reads your
Cargo.tomlto check for known heavy feature combinations (e.g.,tokiowithfull,synwithfull) - Generates a sorted report with color-coded durations and actionable recommendations
- Run
cargo cleanbeforecargo why-slowto get accurate timings (cached builds show 0s) - Proc-macro crates compile serially and often dominate build times
- Consider replacing heavy dependencies with lighter alternatives
- Use only the features you need (e.g.,
tokio = { features = ["rt", "net"] }instead offeatures = ["full"])
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.