Skip to content

test_codecopy_benchmark()

Documentation for tests/benchmark/compute/instruction/test_account_query.py::test_codecopy_benchmark@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/benchmark/compute/instruction/test_account_query.py::test_codecopy_benchmark --gas-benchmark-values 1

Benchmark CODECOPY with varying memory and code size config.

Source code in tests/benchmark/compute/instruction/test_account_query.py
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@pytest.mark.repricing
@pytest.mark.parametrize("mem_size", [0, 32, 256, 1024])
@pytest.mark.parametrize("code_size", [0, 32, 256, 1024, 24576])
def test_codecopy_benchmark(
    benchmark_test: BenchmarkTestFiller,
    mem_size: int,
    code_size: int,
) -> None:
    """Benchmark CODECOPY with varying memory and code size config."""
    setup = Op.MSTORE8(mem_size, 0xFF) if mem_size > 0 else Bytecode()

    attack_block = Op.CODECOPY(Op.PUSH0, Op.PUSH0, code_size)

    benchmark_test(
        target_opcode=Op.CODECOPY,
        code_generator=JumpLoopGenerator(
            setup=setup,
            attack_block=attack_block,
            code_padding_opcode=Op.INVALID,
        ),
    )

Parametrized Test Cases

This test generates 20 parametrized test cases across 3 forks.