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