Skip to content

Commit 06923ef

Browse files
committed
Clarify optimization comment in Cargo.toml (and bump deps to -O2)
The comment in `Cargo.toml` explaining our test optimization was somewhat incorrect - `[profile.dev]` actually already only applies to dependencies, so we were already leaving workspace crates unoptimized with dependencies optimized. At least, I think we were, but its somewhat unclear whether we were optimizing the `lightning` crate when it was a dependency of other workspace crates. So to clarify and ensure we have that behavior, `[profile.dev]` was swapped for `[profile.dev.package."*"]`. Finally, because its a slight win for developers, the `opt-level` on dependencies was set to O2 instead of O1.
1 parent 75ca50f commit 06923ef

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Cargo.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ exclude = [
1313
"no-std-check",
1414
]
1515

16-
# Our tests do actual crypo and lots of work, the tradeoff for -O1 is well worth it.
17-
# Ideally we would only do this in profile.test, but profile.test only applies to
18-
# the test binary, not dependencies, which means most of the critical code still
19-
# gets compiled as -O0. See
16+
# Our tests do actual crypo and lots of work, the tradeoff for -O1 is well
17+
# worth it. Note that we only apply optimizations to dependencies, not workspace
18+
# crates themselves.
2019
# https://doc.rust-lang.org/cargo/reference/profiles.html#profile-selection
21-
[profile.dev]
22-
opt-level = 1
23-
panic = "abort"
20+
[profile.dev.package."*"]
21+
opt-level = 2
2422

2523
[profile.release]
2624
opt-level = 3

0 commit comments

Comments
 (0)