Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sha256 napkin math numbers #32

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Conversation

thundergolfer
Copy link
Contributor

@thundergolfer thundergolfer commented Sep 3, 2024

The sha256 performance numbers are too low. 1GiB/s throughput and ~100ns latency on 64b is achievable with just a bump in the package version, at least on my box :)

The benchmark uses 64b as its per-iteration chunk size, and this underestimates throughput (559MiB/s). At larger chunk sizes 1-1.5 GiB/s is achievable.

Matching tests with regex: hash_sha256

Executing hash_sha256..

[Sha256 <64 B>] Iterations in 5017 miliseconds, no overhead: 46,018,765
[Sha256 <64 B>] Iterations / second: 9,172,566
[Sha256 <64 B>] Bytes handled per iteration: 64 bytes
[Sha256 <64 B>] Total bytes processed: 2.743 GiB
[Sha256 <64 B>] Throughput: 559.849 MiB/s
[Sha256 <64 B>] Avg single iteration: 109 ns
[Sha256 <64 B>] Avg single iteration cycles: 0.00
[Sha256 <64 B>] Time to process 1 MiB: 1786 μs
[Sha256 <64 B>] Time to process 1 GiB: 1829 ms
[Sha256 <64 B>] Time to process 1 TiB: 31.22 min

I ran this on m6i.12xlarge running Ubuntu 20.04, but I generally find that 1GiB/s is the most accurate 'round number' for how fast sha256 is across our worker fleert.

@sirupsen
Copy link
Owner

sirupsen commented Sep 3, 2024

@thundergolfer thank you 🙏🏻

I should re-run on a more recent x86 CPU, bet a lot of these are better now

@sirupsen sirupsen merged commit 7929456 into sirupsen:master Sep 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants