Since we have many computationally expensive tests, this changes the test

profile to compile with optimizations by default, but keep full debug info.

This differs from the release profile in the following ways:
- it does not set `lto = true`, which increases compile times without
  substantially speeding up tests;
- it does not set `codegen-units = 1`, which increases compile times and
  is only useful to improve determinism of release builds;
- it does not set `panic = 'abort'`, which is in any case ignored for
  tests.

After this PR, to get results as close as possible to a release build, use
`cargo test --release`.

To speed up compilation and avoid optimizations potentially resulting in
lower-quality debug info, use `cargo test --profile=dev`.

Times on my machine starting from `cargo clean` for each run:
* `cargo test --all-targets --all-features`:
  * 484s (354s build, 130s tests)
* `cargo test --release --all-targets --all-features`:
  * 541s (415s build, 126s tests)
* `cargo test --profile=dev --all-targets --all-features`:
  * 1709s (146s build, 1563s tests)
  * this might still be faster when running individual tests.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira-Emma Hopwood 2024-11-02 17:59:03 +00:00
parent 35b8c0d781
commit 9d1c898355
1 changed files with 17 additions and 0 deletions

View File

@ -162,5 +162,22 @@ lto = true
panic = 'abort'
codegen-units = 1
[profile.test]
# Since we have many computationally expensive tests, this changes the test profile to
# compile with optimizations by default, but keep full debug info.
#
# This differs from the release profile in the following ways:
# - it does not set `lto = true`, which increases compile times without substantially
# speeding up tests;
# - it does not set `codegen-units = 1`, which increases compile times and is only
# useful to improve determinism of release builds;
# - it does not set `panic = 'abort'`, which is in any case ignored for tests.
#
# To get results as close as possible to a release build, use `cargo test --release`.
# To speed up compilation and avoid optimizations potentially resulting in lower-quality
# debug info, use `cargo test --profile=dev`.
opt-level = 3
debug = true
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("zfuture"))'] }