xref: /relibc/ralloc/benches/vec_box.rs (revision 14e275d8145880b7dca823efefc27a47a3d6e9ef)
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_box(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(Box::new(i))
16         }
17 
18         stuff.reserve(100000);
19 
20         stuff
21     });
22 }
23