Add a benchmark for TxSha.

This commit adds a benchmark for the TxSha function of a MsgTx.
This commit is contained in:
Dave Collins 2014-03-20 10:46:03 -05:00
parent 0e1f6a6628
commit 2de1b73d12

View file

@ -281,3 +281,12 @@ func BenchmarkWriteBlockHeader(b *testing.B) {
btcwire.TstWriteBlockHeader(ioutil.Discard, 0, &header)
}
}
// BenchmarkTxSha performs a benchmark on how long it takes to hash a
// transaction.
func BenchmarkTxSha(b *testing.B) {
tx := btcwire.GenesisBlock.Transactions[0]
for i := 0; i < b.N; i++ {
tx.TxSha()
}
}