Just landed on tonight's nightly @ehuss has done some amazing work to add a new unstable flag to Cargo,
-Z timings, which can be used to help visualize how crates are getting compiled for you and where time is being spent. I wanted to post an announcement for this in case anyone's interested in giving it a spin! While we don't have a ton of plans for stabilization yet, we'd love to see where this feature can go.
To test this out you'll first want to update to the latest nightly:
$ rustup update nightly info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu' nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.39.0-nightly (9b9d2aff8 2019-09-19) info: checking for self-updates
Next you'll want to build locally with:
$ cargo +nightly build -Z timings
timings option takes a list of comma-separated values, and defaults to printing information on the terminal about crate timings and generating a
*.html report with everything in a human-readable form. You can read a bit more about the option online.
Some example graphs look like:
The graphs should be able to graphically show you what crates are taking a long time to compile, where crates are being compiled, etc. You can also see the effect that pipelined compilation has on your compile graph to see when dependencies get unlocked. The documentation for
-Z timings has more information about how to interpret the graphs.
If you're curious give this flag a spin, and if you have feedback please open an issue!