Add benchmarks for writeVarString.
This commit adds a couple of benchmarks for the writeVarString function.
This commit is contained in:
parent
4002051a22
commit
fa8f666e8c
1 changed files with 16 additions and 0 deletions
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue