mirror of
https://github.com/logos-blockchain/sponges.git
synced 2026-07-30 18:43:13 +00:00
The new API provides a better way for exposing support for parallel processing in implemented backends and resolves the issue with branching on each application of a Keccak permutation.
23 lines
550 B
Rust
23 lines
550 B
Rust
//! keccak benchmarks
|
|
|
|
#![feature(test)]
|
|
extern crate test;
|
|
|
|
use core::hint::black_box;
|
|
use keccak::Keccak;
|
|
|
|
macro_rules! impl_bench {
|
|
($name:ident, $fn:ident, $type:expr) => {
|
|
#[bench]
|
|
fn $name(b: &mut test::Bencher) {
|
|
let mut data = black_box([0; 25]);
|
|
Keccak::new().$fn(|f| b.iter(|| black_box(f(&mut data))))
|
|
}
|
|
};
|
|
}
|
|
|
|
impl_bench!(keccak_f200, with_f200, 0u8);
|
|
impl_bench!(keccak_f400, with_f400, 0u16);
|
|
impl_bench!(keccak_f800, with_f800, 0u32);
|
|
impl_bench!(keccak_f1600, with_f1600, 0u64);
|