txscript: Add benchmark for DisasmString.
This commit is contained in:
parent
c997417978
commit
099784267e
1 changed files with 18 additions and 0 deletions
|
@ -111,3 +111,21 @@ func BenchmarkScriptParsing(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BenchmarkDisasmString benchmarks how long it takes to disassemble a very
|
||||||
|
// large script.
|
||||||
|
func BenchmarkDisasmString(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 := DisasmString(script)
|
||||||
|
if err != nil {
|
||||||
|
b.Fatalf("failed to disasm script: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue