-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
As a a developer working on large executables,
I would like cargo to report the time spent linking executables
so that I can make use the linker that gives me the shortest edit-build-run-tests feedback loop
Currently, i can synthetically achieve that with a hyperfine command that deletes the executable and re-runs cargo build using the total wall-time as an approximation of build time. However, I cannot know how much time it takes cargo to analyse the target/ dir and realise that only the link-step needs to be re-run.
For clean builds I have even less information about link-time alone.
Proposed Solution
- Start measuring the duration of the linker step for
TargetKind::Bin
Add an optional field to TimingInfo
in src/cargo/util/machine_message.rs similar to rmeta_time
#[serde(skip_serializing_if = "Option::is_none")]
pub link_time: Option<f64>,
Which is only populated for targets that required linking.
- In the timings report, separate linking from other build steps
Choose a colour for html and a field for JSON and make it visually obvious to people
Notes
Implementing this enables generating the "Use a different linker" actionable suggestion proposed here
#10542