Skip to content

Commit

Permalink
cargo: compile dev deps with opt-level=3
Browse files Browse the repository at this point in the history
Yuya noted the other day that `pest 2.7.9` seemed to cause testing slowdowns.
Out of curiosity, I decided to see how much `opt-level=0`, which is implied
by the default `dev` profile, costs us. This sets `opt-level=3`, and also sets
`codegen-units=1` as well, which should improve output object file size and
performance, too.

This dramatically speeds up testing by approximately 33% (45 -> 30s on my
machine.) However, it comes at the cost of a higher initial compile time for
dependencies; clean rebuilds nearly double now, from about 40s -> 1m30s. This is
probably a worthy tradeoff, though.

This is all tested on my 6-core/12-thread AMD Zen 3 desktop.

We could target more specific dependencies; we already do so with `insta`. But
compiling everything helps ensure we don't hit more performance cliffs when
some dependency introduces a codepath that behaves very poorly when unoptimized,
especially when they incrementally add up over time and the frog slowly boils.

We may want to tune Dependabot updates to be a little more spaced out (perhaps
once a week, if we can do so) in order to compensate for this.

Signed-off-by: Austin Seipp <[email protected]>
Change-Id: I6d84fac2b9d64d6ef1c8187f227cd1c1caa195ab
  • Loading branch information
thoughtpolice committed Jun 12, 2024
1 parent 4cca845 commit 2589b4d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ jj-lib = { path = "lib", version = "0.18.0" }
jj-lib-proc-macros = { path = "lib/proc-macros", version = "0.18.0" }
testutils = { path = "lib/testutils" }

# Insta suggests compiling these packages in opt mode for faster testing.
# See https://docs.rs/insta/latest/insta/#optional-faster-runs.
[profile.dev.package]
insta.opt-level = 3
similar.opt-level = 3
[profile.dev.package."*"]
codegen-units = 1
opt-level = 3

[profile.release]
strip = "debuginfo"
Expand Down

0 comments on commit 2589b4d

Please sign in to comment.