rust-lang / cargo

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

Tracking Issue for JSON timings #10857

Open ehuss opened 2 years ago

ehuss commented 2 years ago

Summary

Original issue: #7405 Implementation: #7311 Documentation: N/A

--timings=json is an unstable option which emits some JSON information about the build timings. It outputs one JSON object per rustc invocation defined in TimingInfo.

Unresolved Issues

Future Extensions

About tracking issues

Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

repi commented 1 year ago

we would love to have this to be able to build tools that diff build times our large Rust workspaces, both between ordinary code changes in PRs for the workspace as well as for dependency changes and rust upgrades.

That said, we haven't tested yet with the existing unstable support, but it does look like it is missing a lot of functionality that is in the HTML output, such as frontend/backend time split for each build, start time of build etc. Would like to have enough info in the JSON output to be able to recreate the output one currently have in the HTML

smklein commented 7 months ago

This would be a great feature for automated tools to track differences between build speeds.

cargo build --timings, and the corresponding HTML report, are great for consumption by human eyeballs, but are a little rougher for machines to compare. cargo build --timings=json seems like a great tool, to, for example, "compare the time it takes to build a set of many packages in a workspace across all commits to a repo".