Skip to content

Commit

Permalink
tests: Set full data size as number of bytes (#157)
Browse files Browse the repository at this point in the history
* Clean up deps.
* tests: Set full data size as number of bytes

Use total data size (data+parity) as benchmark sizes for more consistent benchmarks.
  • Loading branch information
klauspost authored Dec 18, 2020
1 parent 6e6fbcd commit 7c86824
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ module github.com/klauspost/reedsolomon

go 1.14

require (
github.com/klauspost/cpuid/v2 v2.0.1
github.com/stretchr/testify v1.6.1
)
require github.com/klauspost/cpuid/v2 v2.0.2
15 changes: 2 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/klauspost/cpuid/v2 v2.0.1 h1:lb04bBEJoAoV48eHs4Eq0UyhmJCkRSdIjQ3uS8WJRM4=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
github.com/klauspost/cpuid/v2 v2.0.2 h1:pd2FBxFydtPn2ywTLStbFg9CJKrojATnpeJWSP7Ys4k=
github.com/klauspost/cpuid/v2 v2.0.2/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
14 changes: 7 additions & 7 deletions reedsolomon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ func benchmarkEncode(b *testing.B, dataShards, parityShards, shardSize int) {
fillRandom(shards[s])
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
err = r.Encode(shards)
Expand Down Expand Up @@ -853,7 +853,7 @@ func benchmarkVerify(b *testing.B, dataShards, parityShards, shardSize int) {
b.Fatal(err)
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err = r.Verify(shards)
Expand Down Expand Up @@ -925,7 +925,7 @@ func benchmarkReconstruct(b *testing.B, dataShards, parityShards, shardSize int)
b.Fatal(err)
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
corruptRandom(shards, dataShards, parityShards)
Expand Down Expand Up @@ -999,7 +999,7 @@ func benchmarkReconstructData(b *testing.B, dataShards, parityShards, shardSize
b.Fatal(err)
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
corruptRandomData(shards, dataShards, parityShards)
Expand Down Expand Up @@ -1052,7 +1052,7 @@ func benchmarkReconstructP(b *testing.B, dataShards, parityShards, shardSize int
b.Fatal(err)
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.ResetTimer()

b.RunParallel(func(pb *testing.PB) {
Expand All @@ -1069,7 +1069,7 @@ func benchmarkReconstructP(b *testing.B, dataShards, parityShards, shardSize int
if err != nil {
b.Fatal(err)
}

b.ResetTimer()
for pb.Next() {
corruptRandom(shards, dataShards, parityShards)

Expand Down Expand Up @@ -1521,7 +1521,7 @@ func benchmarkParallel(b *testing.B, dataShards, parityShards, shardSize int) {
shardsCh <- shards
}

b.SetBytes(int64(shardSize * dataShards))
b.SetBytes(int64(shardSize * (dataShards + parityShards)))
b.SetParallelism(c)
b.ReportAllocs()
b.ResetTimer()
Expand Down

0 comments on commit 7c86824

Please sign in to comment.