From 2589b4d1ceebe388f1a3dc0fd55fce95ad32fcb2 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 4 Apr 2024 01:35:05 -0500 Subject: [PATCH] cargo: compile `dev` deps with `opt-level=3` 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 Change-Id: I6d84fac2b9d64d6ef1c8187f227cd1c1caa195ab --- Cargo.toml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a40020d12f..d00c8ca217 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"