diff options
| author | Jack O'Connor <[email protected]> | 2019-12-08 18:17:09 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2019-12-08 21:56:10 -0500 |
| commit | ae7271cc87c6f7f5743563a208f693fbf901fe8c (patch) | |
| tree | 341cacf6ef9d7c49fab03288acf6aa4a101d8dd5 /benches | |
| parent | 78191a676fbd2e58fd24e49e019e7d670b5b43ea (diff) | |
add benchmarks for AVX-512 and NEON
Diffstat (limited to 'benches')
| -rw-r--r-- | benches/bench.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/benches/bench.rs b/benches/bench.rs index 571e18b..ec7658c 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -80,6 +80,15 @@ fn bench_single_compression_sse41(b: &mut Bencher) { bench_single_compression_fn(b, blake3::sse41::compress); } +#[bench] +#[cfg(feature = "c_avx512")] +fn bench_single_compression_avx512(b: &mut Bencher) { + if !blake3::platform::avx512_detected() { + return; + } + bench_single_compression_fn(b, blake3::c_avx512::compress); +} + type HashManyFn<A> = unsafe fn( inputs: &[&A], key: &[u8; blake3::KEY_LEN], @@ -136,6 +145,22 @@ fn bench_many_chunks_avx2(b: &mut Bencher) { bench_many_chunks_fn(b, blake3::avx2::hash_many, blake3::avx2::DEGREE); } +#[bench] +#[cfg(feature = "c_avx512")] +fn bench_many_chunks_avx512(b: &mut Bencher) { + if !blake3::platform::avx512_detected() { + return; + } + bench_many_chunks_fn(b, blake3::c_avx512::hash_many, blake3::c_avx512::DEGREE); +} + +#[bench] +#[cfg(feature = "c_neon")] +fn bench_many_chunks_neon(b: &mut Bencher) { + // When "c_neon" is on, NEON support is assumed. + bench_many_chunks_fn(b, blake3::c_neon::hash_many, blake3::c_neon::DEGREE); +} + // TODO: When we get const generics we can unify this with the chunks code. fn bench_many_parents_fn(b: &mut Bencher, f: HashManyFn<[u8; BLOCK_LEN]>, degree: usize) { let mut inputs = Vec::new(); @@ -182,6 +207,22 @@ fn bench_many_parents_avx2(b: &mut Bencher) { bench_many_parents_fn(b, blake3::avx2::hash_many, blake3::avx2::DEGREE); } +#[bench] +#[cfg(feature = "c_avx512")] +fn bench_many_parents_avx512(b: &mut Bencher) { + if !blake3::platform::avx512_detected() { + return; + } + bench_many_parents_fn(b, blake3::c_avx512::hash_many, blake3::c_avx512::DEGREE); +} + +#[bench] +#[cfg(feature = "c_neon")] +fn bench_many_parents_neon(b: &mut Bencher) { + // When "c_neon" is on, NEON support is assumed. + bench_many_parents_fn(b, blake3::c_neon::hash_many, blake3::c_neon::DEGREE); +} + fn bench_atonce(b: &mut Bencher, len: usize) { let mut input = RandomInput::new(b, len); b.iter(|| blake3::hash(input.get())); |
