Why is there a large performance impact when looping over an array with 240 or more elements?
When running a sum loop over an array in Rust, I noticed a huge performance drop when CAPACITY >= 240. CAPACITY = 239 is about 80 times faster. Is there special compilation optimization Rust is doing for “short” arrays? Compiled with rustc -C opt-level=3. use std::time::Instant; const CAPACITY: usize = 240; const IN_LOOPS: usize = … Read more