mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
txscript: Add benchmark for IsPayToScriptHash.
This commit is contained in:
parent
c771f4fb38
commit
665c29802e
@ -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 New Issue
Block a user