From fe713b8013d355b335d7422a5b6244484332c0bb Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 6 Nov 2013 16:56:42 -0600 Subject: [PATCH] Add benchmarks for transaction Serialize. This commit adds a benchmark for the MsgTx.BtcEncode/Serialize functions. --- bench_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bench_test.go b/bench_test.go index 377ab0aa..6bbd6154 100644 --- a/bench_test.go +++ b/bench_test.go @@ -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) + + } +}