blob: 8bf87e9b73d0212f29aea1f618996e2d4ea4575c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#![feature(test)]
extern crate test;
use crossbeam_epoch as epoch;
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_pin(b: &mut Bencher) {
b.iter(epoch::pin);
}
#[bench]
fn multi_pin(b: &mut Bencher) {
const THREADS: usize = 16;
const STEPS: usize = 100_000;
b.iter(|| {
scope(|s| {
for _ in 0..THREADS {
s.spawn(|_| {
for _ in 0..STEPS {
epoch::pin();
}
});
}
})
.unwrap();
});
}
|