rust/library/core/benches/ops.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
253 B
Rust
Raw Normal View History

use core::ops::*;
use test::Bencher;
// Overhead of dtors
struct HasDtor {
_x: isize,
}
impl Drop for HasDtor {
fn drop(&mut self) {}
}
#[bench]
fn alloc_obj_with_dtor(b: &mut Bencher) {
b.iter(|| {
HasDtor { _x: 10 };
})
}