I posted this on stackoverflow.
What happens is that when using retain over a vector, it seems to be a lot slower in version 1.38.0.
host is: x86_64-unknown-linux-gpu (according to rustc--version --verbose) and LLVM version is 8.0.
I'm using ubuntu 19.04.
As I wrote on SO, I tried:
use std::time::Instant;
fn main() {
let start = Instant::now();
let mut my_vec:Vec<u32>;
for _ in 0..100_000{
my_vec = (0..10_000).collect();
my_vec.retain(|&x| x < 9000);
my_vec.retain(|&x| x < 8000);
my_vec.retain(|&x| x < 7000);
my_vec.retain(|&x| x < 6000);
my_vec.retain(|&x| x < 5000);
my_vec.retain(|&x| (x < 5) & (x > 2));
}
let duration = start.elapsed();
println!("Program took: {:?}", duration);
}
And changed between versions with rustup default 1.36.0 and rustup default stable, having updated rust before with rustup update.
p.s.: From my complete program I also noticed that version 1.38.0 was still a little bit slower without using retain(). But the difference was minimal (~5%) and hard to come up with another culprit.
I posted this on stackoverflow.
What happens is that when using retain over a vector, it seems to be a lot slower in version 1.38.0.
host is: x86_64-unknown-linux-gpu (according to rustc--version --verbose) and LLVM version is 8.0.
I'm using ubuntu 19.04.
As I wrote on SO, I tried:
And changed between versions with
rustup default 1.36.0andrustup default stable, having updated rust before withrustup update.p.s.: From my complete program I also noticed that version 1.38.0 was still a little bit slower without using retain(). But the difference was minimal (~5%) and hard to come up with another culprit.