Skip to content

Commit

Permalink
Define 20 version history for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey authored and melekes committed Feb 1, 2018
1 parent 908bcb7 commit 58179ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions benchmarks/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
db "github.com/tendermint/tmlibs/db"
)

const historySize = 20

func randBytes(length int) []byte {
key := make([]byte, length)
// math.rand.Read always returns err=nil
Expand Down Expand Up @@ -39,8 +41,8 @@ func commitTree(b *testing.B, t *iavl.VersionedTree) {
if err != nil {
b.Errorf("Can't save: %v", err)
}
if version > 2 {
err = t.DeleteVersion(version - 2)
if version > historySize {
err = t.DeleteVersion(version - historySize)
if err != nil {
b.Errorf("Can't delete: %v", err)
}
Expand Down

0 comments on commit 58179ca

Please sign in to comment.