I added performance tests to make sure the Nif won't fail on load.
Sidenote:
I just benchmarked ex_keccak Rust Nif and keccakf1600 C Nif. Unfortunately, ex_keccak is slower both in sequential and parallel benchmarks. I compiled ex_keccak in release mode.
it's ~2,06 times slower in the sequential bench. and ~4 times slower in the parallel bench
sequential:
Benchmarking ex_keccak...
Benchmarking keccakf1600...
Name ips average deviation median 99th %
keccakf1600 719.32 K 1.39 μs ±1753.16% 1.24 μs 2.23 μs
ex_keccak 349.23 K 2.86 μs ±971.32% 2.42 μs 7.23 μs
Comparison:
keccakf1600 719.32 K
ex_keccak 349.23 K - 2.06x slower +1.47 μs
Memory usage statistics:
Name Memory usage
keccakf1600 48 B
ex_keccak 120 B - 2.50x memory usage +72 B
Parallel (6 processes):
Benchmarking ex_keccak...
Benchmarking keccakf1600...
Name ips average deviation median 99th %
keccakf1600 462.56 K 2.16 μs ±743.60% 2.58 μs 2.88 μs
ex_keccak 113.86 K 8.78 μs ±823.86% 4.92 μs 38.62 μs
Comparison:
keccakf1600 462.56 K
ex_keccak 113.86 K - 4.06x slower +6.62 μs
Memory usage statistics:
Name Memory usage
keccakf1600 48 B
ex_keccak 120 B - 2.50x memory usage +72 B
I added performance tests to make sure the Nif won't fail on load.
Sidenote: I just benchmarked
ex_keccak
Rust Nif andkeccakf1600
C Nif. Unfortunately, ex_keccak is slower both in sequential and parallel benchmarks. I compiledex_keccak
in release mode.it's ~2,06 times slower in the sequential bench. and ~4 times slower in the parallel bench sequential:
Parallel (6 processes):