3 ms·
> The Rust assembly to me just looks very unoptimized! If you're not adding a flag like `-C opt-level=3` to the compiler invocation this is literally true. (Fo
by dbaupp 11y ago
> The Rust assembly to me just looks very unoptimized!
If you're not adding a flag like `-C opt-level=3` to the compiler invocation this is literally true. (For one, Rust's unoptimised code does more work than C's, e.g. arithmetic operations are checked for overflow in debug mode, which is the default when optimisations are off, but is disabled when optimisations are on.)
With optimisations on, Rust seems to do a better job, e.g. the loop in the max_array example is vectorised and unrolled by Rust, but not by gcc or clang.