rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.77k stars 2.42k forks source link

Highlight transitive dependencies in --timings graph #7479

Open HadrienG2 opened 5 years ago

HadrienG2 commented 5 years ago

The -Ztimings graph gives a hint of why some crates are built by highlighting which crate depends on which other crate on mouse hover, which is great.

However, it it hard to follow long dependency chains (e.g. those from the rand and num micro-crates) because each crate in the dependency chain must be hovered one by one. Further, the entire dependency chain may not be displayed if a min unit time filter is enabled.

This problem could be resolved by highlighting transitive dependency relationships. But an obvious problem to be resolved is that everyone has a dependency relationship with everyone else if the dependency graph is searched at a deep enough depth. I think this could be addressed by either...

  1. Adjusting the dependency link color according to distance in the dependency graph: the "closer" two crates are, the stronger the color. The distance metric could be weighted by crate build time in order to correctly highlight complex dependency chains from micro-crates.
  2. Another approach would be to focus the crate dependency display on specific kinds of dependencies that are likely to be of highest interest to the user, such as critical-path dependencies.
luser commented 4 years ago

Another approach would be to focus the crate dependency display on specific kinds of dependencies that are likely to be of highest interest to the user, such as critical-path dependencies.

When I've looked at the timing output the biggest question I want to answer is "what can I do to speed up the build?" The most interesting thing to know for that is probably "what's on the critical path?"