Benchmarking sha256-simd with go 1.18 ASM implementation
benduncan opened this issue · comments
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?
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
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.
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.
To answer you Q, we do not have any current plans for improvements.