4e6b475470
- Add a `bench` feature that exposes a hasher benchmark. - Make the hasher read up to the next piece end and hash everything it reads, instead of hashing one byte at a time. This was a 4x improvement on the benchmark. (Terrible code == easy wins!) type: performance
14 lines
296 B
Rust
14 lines
296 B
Rust
use criterion::{criterion_group, criterion_main, Criterion};
|
|
|
|
use imdl::bench::{Bench, HasherBench};
|
|
|
|
fn bench(c: &mut Criterion) {
|
|
let bench = HasherBench::init();
|
|
|
|
c.bench_function(&bench.name(), |b| b.iter(|| bench.iter()));
|
|
}
|
|
|
|
criterion_group!(benches, bench);
|
|
|
|
criterion_main!(benches);
|