txscript: Add multisig redeem script extract bench.

This commit is contained in:
Dave Collins 2019-03-13 01:12:14 -05:00
parent c596826688
commit b0f5561776
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

@ -472,3 +472,20 @@ func BenchmarkCalcMultiSigStats(b *testing.B) {
}
}
}
// BenchmarkMultisigRedeemScript benchmarks how long it takes to extract the
// redeem script for a very large script.
func BenchmarkMultisigRedeemScript(b *testing.B) {
// NOTE: This isn't actually a p2sh multisig which the function being
// benchmarked expects, but it is acceptable for the purposes of the
// benchmark.
script, err := genComplexScript()
if err != nil {
b.Fatalf("failed to create benchmark script: %v", err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = MultisigRedeemScriptFromScriptSig(script)
}
}