Skip to content

Commit 0794ea6

Browse files
committed
bench: Add benchmark case with max non-nested containers
1 parent 3e14f03 commit 0794ea6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/internal_benchmarks/eof_validation_bench.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ const bytes max_code_sections = [] {
2424
return eof_code_sections_1024;
2525
}();
2626

27+
const bytes max_containers = [] {
28+
bytecode code;
29+
for (auto i = 0; i < 256; ++i)
30+
code += eofcreate()
31+
.container(static_cast<uint8_t>(i))
32+
.input(push0(), push0())
33+
.salt(push0())
34+
.value(push0()) +
35+
OP_POP;
36+
code += bytecode{OP_STOP};
37+
38+
auto container = eof_bytecode(code, 4);
39+
for (auto i = 0; i < 256; ++i)
40+
container = container.container(eof_bytecode(OP_INVALID));
41+
return container;
42+
}();
43+
2744
const bytes max_nested_containers = [] {
2845
bytecode code{};
2946
bytecode nextcode = eof_bytecode(OP_INVALID);
@@ -186,6 +203,8 @@ void eof_validation(benchmark::State& state, evmone::ContainerKind kind, const b
186203
using enum evmone::ContainerKind;
187204
BENCHMARK_CAPTURE(eof_validation, max_code_sections, runtime, max_code_sections)
188205
->Unit(benchmark::kMicrosecond);
206+
BENCHMARK_CAPTURE(eof_validation, max_containers, runtime, max_containers)
207+
->Unit(benchmark::kMicrosecond);
189208
BENCHMARK_CAPTURE(eof_validation, stack_height_max_span, runtime, stack_height_max_span)
190209
->Unit(benchmark::kMicrosecond);
191210
BENCHMARK_CAPTURE(eof_validation, max_nested_containers, runtime, max_nested_containers)

0 commit comments

Comments
 (0)