Add benchmarks for writeOutPoint.
This commit adds a benchmark for the writeOutPoint function.
This commit is contained in:
parent
8a1828a2d6
commit
547b648702
2 changed files with 18 additions and 0 deletions
|
@ -112,3 +112,15 @@ func BenchmarkWriteVarStr10(b *testing.B) {
|
|||
btcwire.TstWriteVarString(ioutil.Discard, 0, "test012345")
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkWriteOutPoint performs a benchmark on how long it takes to write a
|
||||
// transaction output point.
|
||||
func BenchmarkWriteOutPoint(b *testing.B) {
|
||||
op := &btcwire.OutPoint{
|
||||
Hash: btcwire.ShaHash{},
|
||||
Index: 0,
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
btcwire.TstWriteOutPoint(ioutil.Discard, 0, 0, op)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,3 +102,9 @@ func TstWriteBlockHeader(w io.Writer, pver uint32, bh *BlockHeader) error {
|
|||
func TstReadMessageHeader(r io.Reader) (*messageHeader, error) {
|
||||
return readMessageHeader(r)
|
||||
}
|
||||
|
||||
// TstWriteOutPoint makes the internal writeOutPoint function available to the
|
||||
// test package.
|
||||
func TstWriteOutPoint(w io.Writer, pver uint32, version uint32, op *OutPoint) error {
|
||||
return writeOutPoint(w, pver, version, op)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue