hash.rs 486 B

1234567891011121314
  1. use criterion::{black_box, criterion_group, criterion_main, Criterion};
  2. use utils::hash::{AesHashFunction, HashFunction};
  3. pub fn bench_hash_range(c: &mut Criterion) {
  4. let n = 100_000;
  5. let range_size = 10_000;
  6. let hash_function = AesHashFunction::<u32>::sample(range_size);
  7. c.bench_function("AesHashFunction.hash_range", |b| {
  8. b.iter(|| hash_function.hash_range(black_box(0..n)))
  9. });
  10. }
  11. criterion_group!(benches, bench_hash_range);
  12. criterion_main!(benches);