Skip to content

Instantly share code, notes, and snippets.

@dtynn
Created February 12, 2020 13:29
Show Gist options
  • Save dtynn/3fef22df85c83bfb77a224b30f5d09f0 to your computer and use it in GitHub Desktop.
Save dtynn/3fef22df85c83bfb77a224b30f5d09f0 to your computer and use it in GitHub Desktop.
use std::{env, thread::sleep, time::Duration};
fn main() {
let flag = env::args().nth(1).unwrap_or("".to_owned());
match flag.as_str() {
"" => {
println!("using vec![vec![u32; 14]; 1<<30]");
let _cache = vec![vec![0u32; 14]; 1 << 30];
println!("hold 10s");
sleep(Duration::from_secs(10));
}
_ => {
println!("using vec![u32; 14<<30]");
let mut cache = vec![0u32; 14 << 30];
for i in 0..cache.len() {
cache[i] = i as u32;
}
println!("hold 10s");
sleep(Duration::from_secs(10));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment