box.rs 330 B

1234567891011121314151617
  1. #![feature(test)]
  2. extern crate ralloc;
  3. extern crate test;
  4. #[global_allocator]
  5. static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
  6. #[bench]
  7. fn bench_box(b: &mut test::Bencher) {
  8. b.iter(|| {
  9. let _bx1 = Box::new(0xF000D);
  10. let _bx2 = Box::new(0xF0002);
  11. "abc".to_owned().into_boxed_str()
  12. });
  13. }