transaction: add benchmark for transaction serialization

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-08-06 10:22:06 +03:00
parent b989504d74
commit 620295efe3

View file

@ -64,3 +64,14 @@ func BenchmarkTransaction_Bytes(b *testing.B) {
_ = tx.Bytes()
}
}
func BenchmarkGetVarSize(b *testing.B) {
tx, err := NewTransactionFromBytes(benchTx)
require.NoError(b, err)
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = io.GetVarSize(tx)
}
}