Add benchmarks for transaction Serialize.

This commit adds a benchmark for the MsgTx.BtcEncode/Serialize functions.
This commit is contained in:
Dave Collins 2013-11-06 16:56:42 -06:00
parent 1a1f93865f
commit fe713b8013

View File

@ -201,3 +201,13 @@ func BenchmarkWriteTxIn(b *testing.B) {
btcwire.TstWriteTxIn(ioutil.Discard, 0, 0, txIn) 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)
}
}