Commit 63ec5e2
committed
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:

### 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.1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
| |||
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
0 commit comments