From 2de1b73d122516c0c194698328e4f3fb7d87382d Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 20 Mar 2014 10:46:03 -0500 Subject: [PATCH] Add a benchmark for TxSha. This commit adds a benchmark for the TxSha function of a MsgTx. --- bench_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bench_test.go b/bench_test.go index d127c328..dda4fb14 100644 --- a/bench_test.go +++ b/bench_test.go @@ -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() + } +}