blob: 2a9a9518d4e7e95c7b5801b9313b92caa6f9bb1b (
plain)
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
32
|
#![feature(test)]
extern crate test;
use polyval::{
universal_hash::{NewUniversalHash, UniversalHash},
Polyval,
};
use test::Bencher;
// TODO(tarcieri): move this into the `universal-hash` crate
macro_rules! bench {
($name:ident, $bs:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let key = Default::default();
let mut m = Polyval::new(&key);
let data = [0; $bs];
b.iter(|| {
m.update_padded(&data);
});
b.bytes = $bs;
}
};
}
bench!(bench1_10, 10);
bench!(bench2_100, 100);
bench!(bench3_1000, 1000);
bench!(bench3_10000, 10000);
|