Debian Codegraph @

debian/rust-vendor/keccak/benches/mod.rs

raw
1 //! keccak benchmarks
2
3 #![feature(test)]
4 extern crate test;
5
6 use core::hint::black_box;
7 use keccak::Keccak;
8
9 macro_rules! impl_bench {
10 ($name:ident, $fn:ident, $type:expr) => {
11 #[bench]
12 fn $name(b: &mut test::Bencher) {
13 let mut data = black_box([0; 25]);
14 Keccak::new().$fn(|f| b.iter(|| black_box(f(&mut data))))
15 }
16 };
17 }
18
19 impl_bench!(keccak_f200, with_f200, 0u8);
20 impl_bench!(keccak_f400, with_f400, 0u16);
21 impl_bench!(keccak_f800, with_f800, 0u32);
22 impl_bench!(keccak_f1600, with_f1600, 0u64);