1 #![feature(test)] 2 3 #[global_allocator] 4 static ALLOCATOR: ralloc::Allocator = ralloc::Allocator; 5 6 extern crate ralloc; 7 extern crate test; 8 9 #[bench] 10 fn bench_vec(b: &mut test::Bencher) { 11 b.iter(|| { 12 let mut stuff = Vec::with_capacity(10); 13 14 for i in 0..10000 { 15 stuff.push(i) 16 } 17 18 stuff.reserve(100000); 19 20 stuff 21 }); 22 } 23