mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
txscript: Add benchmark for GetScriptClass.
This commit is contained in:
parent
77863f5649
commit
69d560c03c
@ -423,3 +423,18 @@ func BenchmarkGetWitnessSigOpCountNested(b *testing.B) {
|
||||
_ = GetWitnessSigOpCount(sigScript, pkScript, witness)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkGetScriptClass benchmarks how long it takes GetScriptClass to
|
||||
// analyze a very large script.
|
||||
func BenchmarkGetScriptClass(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++ {
|
||||
_ = GetScriptClass(script)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user