diff --git a/txscript/bench_test.go b/txscript/bench_test.go index c8f7d0f7..7d0b90c4 100644 --- a/txscript/bench_test.go +++ b/txscript/bench_test.go @@ -341,3 +341,18 @@ func BenchmarkIsUnspendable(b *testing.B) { _ = IsUnspendable(script) } } + +// BenchmarkGetSigOpCount benchmarks how long it takes to count the signature +// operations of a very large script. +func BenchmarkGetSigOpCount(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++ { + _ = GetSigOpCount(script) + } +}