Warn at startup if running unoptimized
Sometimes, a user unaccustomed to Rust will also neglect to read the instructions, and build Arti without using the --release
flag.
This will, predictably, result in unacceptably slow performance.
Can we give them a hint that about what they should do to fix the issue? For example, something like...
It looks like you built Arti without any optimizations!
This will result in *very slow* performance.
If you want Arti to be fast, make sure you run "cargo build"
or "cargo run" with the "--release" flag.
Such a warning wouldn't need to be 100% robust against every possible mistake; just the ones that people seem likeliest to make in practice.
It's not obvious how to actually do detect an unoptimized build, though.
- One questionable solution would be to look for
#[cfg(debug_assertions)]
. That's pretty fragile, though. - A better solution might be to write a
build.rs
script that looks atOPT_LEVEL
and exposes this information to the rest of the program.