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

Switch back to upstream minio/sha256-simd #148

Closed
lrettig opened this issue Jul 26, 2022 · 2 comments · Fixed by spacemeshos/post#88
Closed

Switch back to upstream minio/sha256-simd #148

lrettig opened this issue Jul 26, 2022 · 2 comments · Fixed by spacemeshos/post#88
Assignees

Comments

@lrettig
Copy link
Member

lrettig commented Jul 26, 2022

We forked https://github.com/minio/sha256-simd into https://github.com/spacemeshos/sha256-simd to add spacemeshos/sha256-simd#2 but it was added upstream. We should probably switch back to the upstream repo - is there any reason to maintain a fork?

@fasmat
Copy link
Member

fasmat commented Nov 24, 2022

I checked the following repositories:

  • go-spacemesh
  • merkle-tree
  • poet

All have been updated recently to use the newest version of https://github.com/minio/sha256-simd. None of their dependencies use minio/sha256-smid or spacemeshos/sha256-smid.

Only post uses crypto/sha256 instead of minio/sha256-smid for its FastOracle function. If you agree I would update this to use the optimized library and then consider this ticket as done?

@fasmat fasmat self-assigned this Nov 24, 2022
@fasmat fasmat moved this from 📋 Backlog to 🏗 Doing in Dev team kanban Nov 24, 2022
@fasmat
Copy link
Member

fasmat commented Nov 24, 2022

As for why we are using https://github.com/minio/sha256-simd over crypto/sha256 in our code base:

On some systems we tested (specifically Mac M1) there is little to no performance gain over using the custom library (tests were performed by hashing 100 bytes of data):

goos: linux
goarch: arm64
BenchmarkHash/golang-6         	15897987	        75.88 ns/op	1317.93 MB/s	       0 B/op	       0 allocs/op
BenchmarkHash/minio-6          	16463313	        72.87 ns/op	1372.26 MB/s	       0 B/op	       0 allocs/op

on other systems (here AMD64) there was a significant performance difference between the two libraries:

goos: linux
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i9-12900KF
BenchmarkHash/golang-24         	 5231113	       222.2 ns/op	 450.14 MB/s	       0 B/op	       0 allocs/op
BenchmarkHash/minio-24          	14489305	        81.75 ns/op	1223.20 MB/s	       0 B/op	       0 allocs/op 

Since there are still at least some platforms where minio performs considerably better than the standard library, but none that we tested were worse, we will keep using https://github.com/minio/sha256-simd

Repository owner moved this from 🏗 Doing to ✅ Done in Dev team kanban Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants