diff --git a/bench_test.go b/bench_test.go index d5c84343..a62f0d68 100644 --- a/bench_test.go +++ b/bench_test.go @@ -96,3 +96,19 @@ func BenchmarkReadVarStr10(b *testing.B) { btcwire.TstReadVarString(bytes.NewBuffer(buf), 0) } } + +// BenchmarkWriteVarStr4 performs a benchmark on how long it takes to write a +// four byte variable length string. +func BenchmarkWriteVarStr4(b *testing.B) { + for i := 0; i < b.N; i++ { + btcwire.TstWriteVarString(ioutil.Discard, 0, "test") + } +} + +// BenchmarkWriteVarStr10 performs a benchmark on how long it takes to write a +// four byte variable length string. +func BenchmarkWriteVarStr10(b *testing.B) { + for i := 0; i < b.N; i++ { + btcwire.TstWriteVarString(ioutil.Discard, 0, "test012345") + } +}