Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #12420 - Angelin01:timings-show-version, r=weihanglo
Display crate version on timings graph ### What does this PR try to resolve? Fixes #7384 The solution here is the simplest one: since duplicate crates with different versions can cause confusion, we always output the version. ### How should we test and review this PR? Build any create using the `--timings` option: ``` cargo build --timings ``` and verify the resulting HTML file. ### Additional information The formatting is consistent with how the crates are displayed in the terminal output for Cargo and also on the table below the graph. Initially, [this comment](#7384 (comment)) suggested said formatting for ease of searching, but I do believe the browser can't search in the graph itself. Sample console output: ``` Compiling lazycell v1.3.0 Compiling unicode-xid v0.2.4 Compiling unicode-width v0.1.10 Compiling glob v0.3.1 Compiling curl-sys v0.4.65+curl-8.2.1 Compiling curl v0.4.44 Compiling git2 v0.17.2 ``` Sample rendered HTML output: ![image](https://github.com/rust-lang/cargo/assets/17818024/23aae84e-5107-4352-8d0f-ecdfcac59187) ### Possible issues and future work A possible issue in this solution is that the output becomes too noisy. Other possible solutions: - Only display the version if there are two "units" with the same name. One possible implementation is to count the names, aggregate them in a simple map and look it up during rendering. - Create a small selection to select the disambiguate method between "Never", "Always" and "Only duplicates". This may be overkill.
- Loading branch information