mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Benchmark script verification with 100 nested IFs
This commit is contained in:
parent
270616228b
commit
89fb241c54
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user