txscript: Add benchmark for isAnyKindOfScriptHash.

This commit is contained in:
Dave Collins 2019-03-13 01:11:23 -05:00
parent 51f76392b4
commit bc56df1046
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

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