mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 18:00:11 +01:00
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
@ -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)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user