mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-23 14:32:32 +00:00
Add benchmarks for writeVarString.
This commit adds a couple of benchmarks for the writeVarString function.
This commit is contained in:
parent
4002051a22
commit
fa8f666e8c
@ -96,3 +96,19 @@ func BenchmarkReadVarStr10(b *testing.B) {
|
|||||||
btcwire.TstReadVarString(bytes.NewBuffer(buf), 0)
|
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…
x
Reference in New Issue
Block a user