mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
txscript: Add benchmark for GetSigOpCount.
This commit is contained in:
parent
98dd6a900f
commit
8316a06a0e
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user