2017-02-03 17:04:22 -06:00
|
|
|
use core::ops::*;
|
|
|
|
use test::Bencher;
|
|
|
|
|
|
|
|
// Overhead of dtors
|
|
|
|
|
|
|
|
struct HasDtor {
|
2019-12-06 22:18:12 -06:00
|
|
|
_x: isize,
|
2017-02-03 17:04:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for HasDtor {
|
2019-12-06 22:18:12 -06:00
|
|
|
fn drop(&mut self) {}
|
2017-02-03 17:04:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn alloc_obj_with_dtor(b: &mut Bencher) {
|
|
|
|
b.iter(|| {
|
2019-12-06 22:18:12 -06:00
|
|
|
HasDtor { _x: 10 };
|
2017-02-03 17:04:22 -06:00
|
|
|
})
|
|
|
|
}
|