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

Benchmarking sha256-simd with go 1.18 ASM implementation #65

Closed
benduncan opened this issue Oct 21, 2022 · 4 comments
Closed

Benchmarking sha256-simd with go 1.18 ASM implementation #65

benduncan opened this issue Oct 21, 2022 · 4 comments

Comments

@benduncan
Copy link

Hi folks,

Firstly, well done on writing sha256-simd, I have used this in project prior to Go 1.18 and was impressed by the performance improvements and minio's ASM implementation (great code).

For a project I was benchmarking various SHA-256 implementations, including OpenSSL, NodeJS and Go.

https://github.com/benduncan/sha-benchmark-avx-simd-native

Based on my research it seems the latest Go 1.18 sha implementation has about on par with sha256-simd -- If anyone can help confirm that'd be great.

Looking forward, is there any new approaches to optimise sha256-simd, or has this reached the end given the latest changes in the standard library?

@klauspost
Copy link
Contributor

Last time I checked the stdlib didn't include "Intel SHA Extensions" (which ironically is better supported on AMD)

Looking at your logs, am I wrong to interpret that it is faster?

256M.bin > go-native

real	0m59.349s
user	0m59.307s
sys	0m0.168s
-
256M.bin > go-simd

real	0m16.519s
user	0m16.456s
sys	0m0.104s

@AudriusButkevicius
Copy link

AudriusButkevicius commented Oct 21, 2022

I know that on my home computer with ryzen 2700x, latest and greatest at the time, which has native sha instructions was something like a factor of 4 faster. This was a few years ago, so perhaps go stdlib has cought up since. I also know at the time the sha instructions were only available on intels server cpu models, not the domestic ones.

@klauspost
Copy link
Contributor

klauspost commented Oct 21, 2022

Go is extremely hesitant to include crypto changes - especially to asm. I wouldn't expect it to be included unless a major corpo pushes for it.

@klauspost
Copy link
Contributor

To answer you Q, we do not have any current plans for improvements.

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

No branches or pull requests

3 participants