diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bench/verify_script.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp index 1c025e29d3..5894f22b5b 100644 --- a/src/bench/verify_script.cpp +++ b/src/bench/verify_script.cpp @@ -71,4 +71,27 @@ static void VerifyScriptBench(benchmark::State& state) } } +static void VerifyNestedIfScript(benchmark::State& state) { + std::vector<std::vector<unsigned char>> stack; + CScript script; + for (int i = 0; i < 100; ++i) { + script << OP_1 << OP_IF; + } + for (int i = 0; i < 1000; ++i) { + script << OP_1; + } + for (int i = 0; i < 100; ++i) { + script << OP_ENDIF; + } + while (state.KeepRunning()) { + auto stack_copy = stack; + ScriptError error; + bool ret = EvalScript(stack_copy, script, 0, BaseSignatureChecker(), SigVersion::BASE, &error); + assert(ret); + } +} + + BENCHMARK(VerifyScriptBench, 6300); + +BENCHMARK(VerifyNestedIfScript, 100); |