Bench sub.

Improve performance for sub.
This commit is contained in:
2018-01-25 11:27:58 +01:00
parent 3367a178b8
commit 96720c83e7
2 changed files with 15 additions and 6 deletions

View File

@@ -33,11 +33,20 @@ fn insert(data: &[u64]) {
}
}
fn sub(a: &BitSet, b: &BitSet) {
a - b;
}
fn criterion_benchmark(c: &mut Criterion) {
let data: Vec<_> = default_set(1000);
c.bench_function("contains", |b| b.iter(|| contains(&data)));
c.bench_function("insert", |b| b.iter(|| insert(&data)));
let lhs: BitSet = default_set(1000);
let rhs: BitSet = default_set(1000);
c.bench_function("sub", |b| b.iter(|| sub(&lhs, &rhs)));
}
criterion_group!(benches, criterion_benchmark);