txscript: Add benchmark for PushedData.
This commit is contained in:
parent
7791f92f6f
commit
c4f6302189
1 changed files with 18 additions and 0 deletions
|
@ -438,3 +438,21 @@ func BenchmarkGetScriptClass(b *testing.B) {
|
|||
_ = GetScriptClass(script)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkPushedData benchmarks how long it takes to extract the pushed data
|
||||
// from a very large script.
|
||||
func BenchmarkPushedData(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++ {
|
||||
_, err := PushedData(script)
|
||||
if err != nil {
|
||||
b.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue