The rustc
compiler has four optimization levels, just like GCC:
opt-level
This flag controls the optimization level.0: no optimization, also turns on cfg(debug_assertions) (the default).
1: basic optimizations.
2: some optimizations.
3: all optimizations.
s: optimize for binary size.
z: optimize for binary size, but also turn off loop vectorization.
If I make a build with Cargo and its --release
option, which optimization level is used?
cargo build --release
Finished release [optimized] target(s) in 0.75s