mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-17 13:06:26 +02: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
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…
Add table
Add a link
Reference in a new issue