Skip to content

Commit

Permalink
arbo: remove failing BenchmarkAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Jul 13, 2023
1 parent bb0b5e0 commit 59998e7
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions tree/arbo/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,36 +890,3 @@ func TestKeyLenBiggerThan32(t *testing.T) {
randomBytes(bLen))
c.Assert(err, qt.IsNil)
}

func BenchmarkAdd(b *testing.B) {
bLen := 32 // for both Poseidon & Sha256
// prepare inputs
var ks, vs [][]byte
for i := 0; i < 1000; i++ {
k := BigIntToBytes(bLen, big.NewInt(int64(i)))
v := BigIntToBytes(bLen, big.NewInt(int64(i)))
ks = append(ks, k)
vs = append(vs, v)
}

b.Run("Poseidon", func(b *testing.B) {
benchmarkAdd(b, HashFunctionPoseidon, ks, vs)
})
b.Run("Sha256", func(b *testing.B) {
benchmarkAdd(b, HashFunctionSha256, ks, vs)
})
}

func benchmarkAdd(b *testing.B, hashFunc HashFunction, ks, vs [][]byte) {
c := qt.New(b)
database := metadb.NewTest(c)
tree, err := NewTree(Config{Database: database, MaxLevels: 140,
HashFunction: hashFunc})
c.Assert(err, qt.IsNil)

for i := 0; i < len(ks); i++ {
if err := tree.Add(ks[i], vs[i]); err != nil {
b.Fatal(err)
}
}
}

0 comments on commit 59998e7

Please sign in to comment.