blake2 simd benches produce unexpected results
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- cryptography, performance
Research direction
Start by running the two cargo +nightly bench commands shown for the default and simd configurations, then inspect the Blake2 benchmark entry points and how throughput is calculated. Done means the reported MB/s values accurately reflect the measured benchmark times and remain consistent between the two configurations.
Written by the indexing model from the issue text.
Description
I ran blake2 tests with and without simd feature enabled and found that behavior is strange and doesn't make a lot of sense.
Default (no simd):
$ cargo +nightly bench
...
running 8 tests
test blake2b512_10 ... bench: 8 ns/iter (+/- 0) = 1250 MB/s
test blake2b512_100 ... bench: 74 ns/iter (+/- 4) = 1351 MB/s
test blake2b512_1000 ... bench: 708 ns/iter (+/- 85) = 1412 MB/s
test blake2b512_10000 ... bench: 7,005 ns/iter (+/- 531) = 1427 MB/s
test blake2s256_10 ... bench: 13 ns/iter (+/- 0) = 769 MB/s
test blake2s256_100 ... bench: 121 ns/iter (+/- 7) = 826 MB/s
test blake2s256_1000 ... bench: 1,155 ns/iter (+/- 62) = 865 MB/s
test blake2s256_10000 ... bench: 11,791 ns/iter (+/- 1,005) = 848 MB/s
test result: ok. 0 passed; 0 failed; 0 ignored; 8 measured; 0 filtered out; finished in 28.22s
Simd:
$ cargo +nightly bench --features simd
...
running 8 tests
test blake2b512_10 ... bench: 11 ns/iter (+/- 0) = 909 MB/s
test blake2b512_100 ... bench: 102 ns/iter (+/- 0) = 980 MB/s
test blake2b512_1000 ... bench: 1,010 ns/iter (+/- 11) = 990 MB/s
test blake2b512_10000 ... bench: 10,076 ns/iter (+/- 68) = 992 MB/s
test blake2s256_10 ... bench: 16 ns/iter (+/- 0) = 625 MB/s
test blake2s256_100 ... bench: 152 ns/iter (+/- 1) = 657 MB/s
test blake2s256_1000 ... bench: 1,483 ns/iter (+/- 12) = 674 MB/s
test blake2s256_10000 ... bench: 14,750 ns/iter (+/- 344) = 677 MB/s
test result: ok. 0 passed; 0 failed; 0 ignored; 8 measured; 0 filtered out; finished in 2.43s
I expected simd version to produce better results and judging by the total execution time it is the case, but throughput reported by the benchmark says the opposite.
I suspect something is wrong with benchmarking code.
Using latest master (cc523733e5ba84b5a366825a7d1150bbbfea368b right now) and rustc 1.65.0-nightly (20ffea693 2022-08-11).
- Dominant language
- Rust
- Stars
- 2.4k
- Forks
- 364
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 18
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RustCrypto/hashes
-
blake2: incorrect size checks resulting in panic in `new_with_salt_and_personal`Possibly taken @kolinabir claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
RustCrypto/hashes#968 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
RustCrypto/hashes#941 ·
Maintainers usually reply within 1 day
-
`blake2::Blake2b512` does not implement `ZeroizeOnDrop`Possibly taken @Johnsonajibi claimed this 95 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
RustCrypto/hashes#912 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
RustCrypto/hashes#908 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
RustCrypto/hashes#763 · 1 comment ·
Maintainers usually reply within 1 day
All issues in RustCrypto/hashes
Similar issues
-
The new tests repeat each other and one only checks a two-line helperMay be free again A pull request for this issue was closed without being merged. Openinfra
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
storytold/wordcraft#9405 · 2 comments ·
Maintainers usually reply within 1 day
-
in-progress
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area: ai-assistants documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BetaBots-LLC/latticegate#17 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
storytold/craft-libs#5594 ·
Maintainers usually reply within 1 day
-
available documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Nixitov/Riptide-Native#932 ·
Maintainers usually reply within 1 day