-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathpolyval.rs
More file actions
31 lines (22 loc) · 770 Bytes
/
polyval.rs
File metadata and controls
31 lines (22 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! POLYVAL benchmarks.
#![allow(missing_docs)]
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use polyval::{Polyval, universal_hash::UniversalHash};
fn bench(c: &mut Criterion) {
let mut group = c.benchmark_group("polyval");
for size in &[10, 100, 1000, 10000] {
let buf = vec![0u8; *size];
group.throughput(Throughput::Bytes(*size as u64));
group.bench_function(BenchmarkId::new("update_padded", size), |b| {
let mut polyval = Polyval::new(&Default::default());
b.iter(|| polyval.update_padded(&buf));
});
}
group.finish();
}
criterion_group!(
name = benches;
config = Criterion::default();
targets = bench
);
criterion_main!(benches);