Skip to content

Commit

Permalink
add blk.paysetCommitSHA256 to BenchmarkTxnRoots
Browse files Browse the repository at this point in the history
  • Loading branch information
cce committed Sep 14, 2022
1 parent 49bf913 commit a291da0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion data/bookkeeping/txn_merkle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func BenchmarkTxnRoots(b *testing.B) {
crypto.RandBytes(txn.PaymentTxnFields.Receiver[:])

sigtxn := transactions.SignedTxn{Txn: txn}
crypto.RandBytes(sigtxn.Sig[:])
ad := transactions.ApplyData{}

stib, err := blk.BlockHeader.EncodeSignedTxn(sigtxn, ad)
Expand All @@ -173,7 +174,7 @@ func BenchmarkTxnRoots(b *testing.B) {
break
}
}

b.Logf("Made block with %d transactions and %d txn bytes", len(blk.Payset), len(protocol.Encode(blk.Payset)))
var r crypto.Digest

b.Run("FlatCommit", func(b *testing.B) {
Expand All @@ -192,6 +193,14 @@ func BenchmarkTxnRoots(b *testing.B) {
}
})

b.Run("SHA256MerkleCommit", func(b *testing.B) {
for i := 0; i < b.N; i++ {
var err error
r, err = blk.paysetCommitSHA256()
require.NoError(b, err)
}
})

_ = r
}

Expand Down

0 comments on commit a291da0

Please sign in to comment.