txscript: Add benchmark for GetSigOpCount.

This commit is contained in:
Dave Collins 2019-03-13 01:11:19 -05:00 committed by Roy Lee
parent f1ab6cc7cb
commit c7218b2622

View file

@ -341,3 +341,18 @@ func BenchmarkIsUnspendable(b *testing.B) {
_ = IsUnspendable(script) _ = IsUnspendable(script)
} }
} }
// BenchmarkGetSigOpCount benchmarks how long it takes to count the signature
// operations of a very large script.
func BenchmarkGetSigOpCount(b *testing.B) {
script, err := genComplexScript()
if err != nil {
b.Fatalf("failed to create benchmark script: %v", err)
}
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = GetSigOpCount(script)
}
}