Skip to content

Commit c175689

Browse files
committed
Add tests for creating a new Rabin64
1 parent 5d85ad4 commit c175689

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

benches/benchmarks.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use cdc::{Rabin64, RollingHash64};
2-
use criterion::{criterion_group, criterion_main, Criterion, BenchmarkId, black_box, Throughput};
2+
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
33

4-
pub fn slide_benchmarks(c: &mut Criterion) {
4+
fn slide_benchmarks(c: &mut Criterion) {
55
let mut group = c.benchmark_group("slide");
66
let data = 16;
77
for size in [1_000, 10_000, 100_000] {
@@ -20,5 +20,15 @@ pub fn slide_benchmarks(c: &mut Criterion) {
2020
}
2121
}
2222

23-
criterion_group!(benches, slide_benchmarks);
23+
fn create_benchmarks(c: &mut Criterion) {
24+
c.bench_function("new", |b| {
25+
b.iter(|| Rabin64::new(5));
26+
});
27+
28+
c.bench_function("with_polynom", |b| {
29+
b.iter(|| Rabin64::new_with_polynom(5, &0x3847fe406c36e1));
30+
});
31+
}
32+
33+
criterion_group!(benches, slide_benchmarks, create_benchmarks);
2434
criterion_main!(benches);

0 commit comments

Comments
 (0)