From 6342bd4edd687b9caca58cfd5266005457d7a392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 14 Aug 2026 17:50:19 +0200 Subject: [PATCH] test: Register the precompile benchmarks uniformly Pass the implementation functions to BENCHMARK() directly instead of through aliases, which makes the namespaces that only kept those aliases apart unnecessary, and drop the redundant enum qualification from the names with a using enum declaration. BENCHMARK_TEMPLATE() is the legacy form and the modexp benchmarks in the same file already use BENCHMARK(). --- test/precompiles_bench/precompiles_bench.cpp | 58 ++++---------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/test/precompiles_bench/precompiles_bench.cpp b/test/precompiles_bench/precompiles_bench.cpp index 66053e9b35..c215bdf654 100644 --- a/test/precompiles_bench/precompiles_bench.cpp +++ b/test/precompiles_bench/precompiles_bench.cpp @@ -23,6 +23,7 @@ namespace { using namespace evmone::state; using namespace evmone::test; +using enum PrecompileId; /// The revision used for the precompile benchmarks. constexpr auto REV = EVMC_OSAKA; @@ -324,58 +325,21 @@ BENCHMARK(modexp) MODEXP_ARGS; #endif #undef MODEXP_ARGS -BENCHMARK_TEMPLATE(precompile, PrecompileId::identity, identity_execute); - -namespace bench_ecrecovery -{ -constexpr auto evmone = ecrecover_execute_evmone; -BENCHMARK_TEMPLATE(precompile, PrecompileId::ecrecover, evmone); +BENCHMARK(precompile); +BENCHMARK(precompile); #ifdef EVMONE_PRECOMPILES_LIBSECP256K1 -constexpr auto libsecp256k1 = ecrecover_execute_libsecp256k1; -BENCHMARK_TEMPLATE(precompile, PrecompileId::ecrecover, libsecp256k1); +BENCHMARK(precompile); #endif -} // namespace bench_ecrecovery - -namespace bench_expmod -{ -constexpr auto evmone = expmod_execute_evmone; -BENCHMARK(precompile); +BENCHMARK(precompile); #ifdef EVMONE_PRECOMPILES_GMP -constexpr auto gmp = expmod_execute_gmp; -BENCHMARK(precompile); +BENCHMARK(precompile); #endif -} // namespace bench_expmod - -namespace bench_ecadd -{ -constexpr auto evmone_cpp = ecadd_execute; -BENCHMARK_TEMPLATE(precompile, PrecompileId::ecadd, evmone_cpp); -} // namespace bench_ecadd - -namespace bench_ecmul -{ -constexpr auto evmone_cpp = ecmul_execute; -BENCHMARK_TEMPLATE(precompile, PrecompileId::ecmul, evmone_cpp); -} // namespace bench_ecmul - -namespace bench_ecpairing -{ -constexpr auto evmone_cpp = ecpairing_execute; -BENCHMARK_TEMPLATE(precompile, PrecompileId::ecpairing, evmone_cpp); -} // namespace bench_ecpairing - -namespace bench_kzg -{ -constexpr auto evmone_blst = point_evaluation_execute; -BENCHMARK_TEMPLATE(precompile, PrecompileId::point_evaluation, evmone_blst); -} // namespace bench_kzg +BENCHMARK(precompile); +BENCHMARK(precompile); +BENCHMARK(precompile); +BENCHMARK(precompile); +BENCHMARK(precompile); } // namespace -namespace bench_p256verify -{ -constexpr auto evmone_cpp = p256verify_execute; -BENCHMARK_TEMPLATE(precompile, PrecompileId::p256verify, evmone_cpp); -} // namespace bench_p256verify - BENCHMARK_MAIN();