txscript: Add benchmark for IsPayToScriptHash.
This commit is contained in:
parent
c771f4fb38
commit
665c29802e
1 changed files with 15 additions and 0 deletions
|
@ -159,3 +159,18 @@ func BenchmarkIsPubKeyHashScript(b *testing.B) {
|
||||||
_ = IsPayToPubKeyHash(script)
|
_ = 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