mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-12 15:03:18 +02:00
bench: improve VerifyNestedIfScript benchmark precision (make stack clearing untimed)
on `master`: | ns/op | op/s | err% | ins/op | cyc/op | IPC | bra/op | miss% | total | benchmark |--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|---------------:|--------:|----------:|:---------- | 19,890.59 | 50,275.02 | 1.3% | 673,992.65 | 85,238.74 | 7.907 | 143,404.89 | 0.0% | 0.01 | `VerifyNestedIfScript` vs this commit: | ns/script | script/s | err% | ins/script | cyc/script | IPC | bra/script | miss% | total | benchmark |--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|---------------:|--------:|----------:|:---------- | 12,089.00 | 82,719.83 | 0.4% | 375,703.00 | 51,987.00 | 7.227 | 69,249.00 | 0.2% | 0.00 | `VerifyNestedIfScript` Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
committed by
Sebastian Falbesoner
parent
616ee6fe74
commit
fbffe8a64a
@@ -115,12 +115,13 @@ static void VerifyNestedIfScript(benchmark::Bench& bench)
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
script << OP_ENDIF;
|
||||
}
|
||||
bench.run([&] {
|
||||
auto stack_copy = stack;
|
||||
ScriptError error;
|
||||
bool ret = EvalScript(stack_copy, script, 0, BaseSignatureChecker(), SigVersion::BASE, &error);
|
||||
assert(ret);
|
||||
});
|
||||
bench.unit("script").epochIterations(1)
|
||||
.setup([&] { stack.clear(); })
|
||||
.run([&] {
|
||||
ScriptError error;
|
||||
const bool ret{EvalScript(stack, script, /*flags=*/0, BaseSignatureChecker(), SigVersion::BASE, &error)};
|
||||
assert(ret && error == SCRIPT_ERR_OK);
|
||||
});
|
||||
}
|
||||
|
||||
BENCHMARK(VerifyScriptP2WPKH);
|
||||
|
||||
Reference in New Issue
Block a user