Skip to content

Commit

Permalink
chore: drop minio/sha256-simd (#264)
Browse files Browse the repository at this point in the history
Closes #161
Blocked on #263

## Testing

The `BenchmarkEDSRoots` benchmark behaves similarly before and after
this PR. Since it is computing roots, I assume the SHA256 operations for
minio/sha256-simd and Go 1.21's crypto/sha256 perform similarly.

### Before

```
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -bench ^BenchmarkEDSRoots$ github.com/celestiaorg/rsmt2d

goos: darwin
goarch: arm64
pkg: github.com/celestiaorg/rsmt2d
BenchmarkEDSRoots/32x32x512_ODS-10         	    1063	   1169687 ns/op	 1791189 B/op	   34052 allocs/op
BenchmarkEDSRoots/64x64x512_ODS-10         	     392	   3056992 ns/op	 6203578 B/op	  133636 allocs/op
BenchmarkEDSRoots/128x128x512_ODS-10       	     100	  10686539 ns/op	26235561 B/op	  530437 allocs/op
BenchmarkEDSRoots/256x256x512_ODS-10       	      31	  42617637 ns/op	106996448 B/op	 2110469 allocs/op
BenchmarkEDSRoots/512x512x512_ODS-10       	       7	 158435357 ns/op	490824795 B/op	 8419427 allocs/op
PASS
ok  	github.com/celestiaorg/rsmt2d	9.528s
```

### After

```
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -bench ^BenchmarkEDSRoots$ github.com/celestiaorg/rsmt2d

goos: darwin
goarch: arm64
pkg: github.com/celestiaorg/rsmt2d
BenchmarkEDSRoots/32x32x512_ODS-10         	    1010	   1168943 ns/op	 1793211 B/op	   34052 allocs/op
BenchmarkEDSRoots/64x64x512_ODS-10         	     381	   3175877 ns/op	 6207691 B/op	  133636 allocs/op
BenchmarkEDSRoots/128x128x512_ODS-10       	     100	  10775309 ns/op	26243828 B/op	  530438 allocs/op
BenchmarkEDSRoots/256x256x512_ODS-10       	      32	  69096212 ns/op	107013057 B/op	 2110472 allocs/op
BenchmarkEDSRoots/512x512x512_ODS-10       	       7	 158312988 ns/op	490854710 B/op	 8419386 allocs/op
PASS
ok  	github.com/celestiaorg/rsmt2d	9.516s
```
  • Loading branch information
rootulp authored Aug 11, 2023
1 parent e1faa53 commit a11a1e6
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datasquare_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package rsmt2d

import (
"crypto/sha256"
"fmt"
"reflect"
"testing"

"github.com/celestiaorg/merkletree"
"github.com/minio/sha256-simd"
"github.com/stretchr/testify/assert"
)

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/minio/sha256-simd v1.0.0
github.com/pmezard/go-difflib v1.0.0 // indirect
gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 // indirect
golang.org/x/crypto v0.1.0 // indirect
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY=
Expand All @@ -22,8 +21,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand Down
2 changes: 1 addition & 1 deletion nmtwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ package rsmt2d

import (
"bytes"
"crypto/sha256"
"fmt"

"github.com/celestiaorg/nmt"
"github.com/celestiaorg/nmt/namespace"
"github.com/minio/sha256-simd"
)

// Fulfills the Tree interface and TreeConstructorFn function
Expand Down
2 changes: 1 addition & 1 deletion tree.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rsmt2d

import (
"github.com/minio/sha256-simd"
"crypto/sha256"

"github.com/celestiaorg/merkletree"
)
Expand Down

0 comments on commit a11a1e6

Please sign in to comment.