summaryrefslogtreecommitdiffstats
path: root/third_party/rust/keccak/benches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/keccak/benches
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/keccak/benches')
-rw-r--r--third_party/rust/keccak/benches/mod.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/third_party/rust/keccak/benches/mod.rs b/third_party/rust/keccak/benches/mod.rs
new file mode 100644
index 0000000000..c080857e39
--- /dev/null
+++ b/third_party/rust/keccak/benches/mod.rs
@@ -0,0 +1,31 @@
+#![feature(test)]
+#![cfg_attr(feature = "simd", feature(portable_simd))]
+
+extern crate keccak;
+extern crate test;
+
+use keccak::{f1600, f200, f400, f800};
+
+macro_rules! impl_bench {
+ ($name:ident, $fn:ident, $type:expr) => {
+ #[bench]
+ fn $name(b: &mut test::Bencher) {
+ let mut data = [$type; 25];
+ b.iter(|| $fn(&mut data));
+ }
+ };
+}
+
+impl_bench!(b_f200, f200, 0u8);
+impl_bench!(b_f400, f400, 0u16);
+impl_bench!(b_f800, f800, 0u32);
+impl_bench!(b_f1600, f1600, 0u64);
+
+#[cfg(feature = "simd")]
+mod simd {
+ use keccak::simd::{f1600x2, f1600x4, f1600x8, u64x2, u64x4, u64x8};
+
+ impl_bench!(b_f1600x2, f1600x2, u64x2::splat(0));
+ impl_bench!(b_f1600x4, f1600x4, u64x4::splat(0));
+ impl_bench!(b_f1600x8, f1600x8, u64x8::splat(0));
+}