diff options
Diffstat (limited to 'rust/vendor/polyval/benches/polyval.rs')
-rw-r--r-- | rust/vendor/polyval/benches/polyval.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/rust/vendor/polyval/benches/polyval.rs b/rust/vendor/polyval/benches/polyval.rs new file mode 100644 index 0000000..2a9a951 --- /dev/null +++ b/rust/vendor/polyval/benches/polyval.rs @@ -0,0 +1,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); |