Add benchmark for writeBlockHeader.

This commit adds a benchmark for the writeBlockHeader function.
This commit is contained in:
Dave Collins 2013-11-07 00:30:20 -06:00
parent bc85a31016
commit 7de20add63

View file

@ -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)
}
}