txscript: Add benchmark for IsPayToScriptHash.
This commit is contained in:
parent
eb03d84098
commit
e7228a2e5f
1 changed files with 15 additions and 0 deletions
|
@ -159,3 +159,18 @@ func BenchmarkIsPubKeyHashScript(b *testing.B) {
|
|||
_ = IsPayToPubKeyHash(script)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkIsPayToScriptHash benchmarks how long it takes IsPayToScriptHash to
|
||||
// analyze a very large script.
|
||||
func BenchmarkIsPayToScriptHash(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++ {
|
||||
_ = IsPayToScriptHash(script)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue