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