Add benchmarks for transaction Serialize.
This commit adds a benchmark for the MsgTx.BtcEncode/Serialize functions.
This commit is contained in:
parent
1a1f93865f
commit
fe713b8013
1 changed files with 10 additions and 0 deletions
|
@ -201,3 +201,13 @@ func BenchmarkWriteTxIn(b *testing.B) {
|
|||
btcwire.TstWriteTxIn(ioutil.Discard, 0, 0, txIn)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkSerializeTx performs a benchmark on how long it takes to serialize
|
||||
// a transaction.
|
||||
func BenchmarkSerializeTx(b *testing.B) {
|
||||
tx := blockOne.Transactions[0]
|
||||
for i := 0; i < b.N; i++ {
|
||||
tx.BtcEncode(ioutil.Discard, 0)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue