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.3k
- Forks
- 343
- Avg merge
- 1h 27m
- Merged PRs (30d)
- 5
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::Blake2b512` does not implement `ZeroizeOnDrop`Possibly taken @Johnsonajibi claimed this 39 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
RustCrypto/hashes#912 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
RustCrypto/hashes#909 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
RustCrypto/hashes#908 ·
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
-
blake2: implement `CustomizedInit` using `digest` macroMay be free again @MavenRain claimed this 72 days ago, and no pull request is open. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
RustCrypto/hashes#747 · 1 comment ·
Maintainers usually reply within 1 day
All issues in RustCrypto/hashes
Similar issues
-
[Bug]: rerank on the huggingface provider (TEI) always costs $0, configured input_cost_per_query is ignoredPossibly taken A pull request linked to this issue is open or already merged. Openllm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
CybercentreCanada/sawp#13 ·
-
area: backend type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
armadavalor/WinKnife#6 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
5omeOtherGuy/phaseone#870 ·
Maintainers usually reply within 1 day