Enable debug assertions in tests - #3639
Conversation
|
@alexcrichton I'm not sure if this was what you intended? I'm seeing some tests time out, likely during Wasm loading, which is possibly a flake - not all guests are hitting it - but could also be down to the longer Wasm preparation times we always see with debug builds (although, why would that not affect other tests). Did I mess up a setting? |
|
This is the change I asked for but the timeouts are not what I hoped for. A smaller fix for #3632 could be:
# When running many tests (such as `make test-integration-full`), test execution
# seems to dominate run time. This profile optimizes for execution time over
# build time while retaining debug assertions.
[profile.bulk-test]
inherits = "release"
debug-assertions = true
overflow-checks = trueand then the There is a chance that one of those debug assertion features is the cause of the slowdown but I would be very surprised if that were the case. Anyway @alexcrichton certainly has a better intuition for these things than I do so I'd like to see what he has to say. |
|
This is definitely what I was thinking, yeah. Doing some profiling locally most of the hot functions are related to diff --git a/Cargo.toml b/Cargo.toml
index c68df9a5..ce228001 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -218,3 +218,6 @@ blocks_in_conditions = "allow"
[[bin]]
name = "spin"
path = "src/bin/spin.rs"
+
+[profile.dev.package."*"]
+opt-level = 2which in theory optimizes all dependencies of spin, but not any workspace members of spin (largely what's desired here I believe). Despite this logging/tracing functions are still dominating the entire profile: Is there anything special about logging in Spin in tests? For example is logging enabled specifically at a higher level during tests? This looks like a bazillion log statements coming out of Cranelift and pretty inefficient processing of them (as one would expect in debug mode) With this: diff --git a/Cargo.toml b/Cargo.toml
index c68df9a5..8323236c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -218,3 +218,8 @@ blocks_in_conditions = "allow"
[[bin]]
name = "spin"
path = "src/bin/spin.rs"
+
+[profile.dev.package."*"]
+opt-level = 2
+[profile.dev.package.spin-telemetry]
+opt-level = 2I can't copy the pid fast enough into |
Looking at the Makefile ( Line 1 in 90dcf45 RUST_LOG=spin=trace, so Spin's own tracing is gonna be pretty verbose. (I see one test that turns logging off, but generally it's this.) But Cranelift and other dependency crates should be operating at default log level with that I think?
Anyway if the goal at hand is to turn on debug assertions, then I reckon maybe I'll roll this back and adopt @lann's "turn on debug assertions" solution which seems... uh... more directly aligned to the goal. But if we want to speed up our tests then yeah that seems a worthy goal too! |
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
326abb7 to
6b48f8e
Compare
alexcrichton
left a comment
There was a problem hiding this comment.
Ah ok makes sense w.r.t. logging yeah, once anything is set to trace the fast-path "is this log disabled" no longer kicks in and the filter has to go to the regex/string matching and that gets real slow in debug mode. In any case the PR as-is I think is fine, although I might recommend inheriting from dev to inherit incrementality and debuginfo while setting opt-level=2 which should be plenty for speed
|
This (probably) explains at least part of the problem: https://github.com/bytecodealliance/wasmtime/blob/790bc4928077915304e5d658fc34b0625348f281/cranelift/codegen/src/lib.rs#L116 Cranelift uses |
Fixes #3632.