Add script to benchmark compilation times #2412
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Docs on cargo profiles: https://doc.rust-lang.org/cargo/reference/profiles.html#debug
Find some tradeoffs for how long compilation takes and how convenient it is to spot issues. Ideally we would have all debug info and the fastest compilation times but that's not possible.
For the CI we definitely don't need debuggers to work but it would be nice to have tracebacks because it's very time consuming to re-run it with a different profile. For local development we should IMO have tracebacks enabled by default for running tests and running the demo. Maybe it should also be possible to attach a debugger without having to re-compile after running tests.
Time it takes to run
cargo build
in seconds:Currently the results show that in order to get minimally useful tracebacks we take about a 10% hit in compilation time. For tracebacks with line numbers it's closer to 15%.
In order to get any meaningful tracebacks we need at least
debug = line-tables-only
andstrip = debuginfo
. This gives tracebacks that don't include line numbers except the place in the code where the panic occured. I think this is whatrelease
does by default.In order to get tracebacks with all files and line numbers we need
strip = "none"
Code I used for this is
cc @tbro