txscript: Add benchmark for IsPayToWitnessScriptHash
This commit is contained in:
parent
4d8edfe6d9
commit
b3dd941a77
1 changed files with 15 additions and 0 deletions
|
@ -297,3 +297,18 @@ func BenchmarkIsWitnessPubKeyHash(b *testing.B) {
|
||||||
_ = IsPayToWitnessPubKeyHash(script)
|
_ = IsPayToWitnessPubKeyHash(script)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BenchmarkIsWitnessScriptHash benchmarks how long it takes to analyze a very
|
||||||
|
// large script to determine if it is a standard witness script hash script.
|
||||||
|
func BenchmarkIsWitnessScriptHash(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++ {
|
||||||
|
_ = IsPayToWitnessScriptHash(script)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue