Add benchmark for writeBlockHeader.
This commit adds a benchmark for the writeBlockHeader function.
This commit is contained in:
parent
bc85a31016
commit
7de20add63
1 changed files with 9 additions and 0 deletions
|
@ -272,3 +272,12 @@ func BenchmarkReadBlockHeader(b *testing.B) {
|
|||
btcwire.TstReadBlockHeader(bytes.NewBuffer(buf), 0, &header)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkWriteBlockHeader performs a benchmark on how long it takes to
|
||||
// serialize a block header.
|
||||
func BenchmarkWriteBlockHeader(b *testing.B) {
|
||||
header := blockOne.Header
|
||||
for i := 0; i < b.N; i++ {
|
||||
btcwire.TstWriteBlockHeader(ioutil.Discard, 0, &header)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue