From 91f6e75437afb11e31a92c5fe1c113b046a5921d Mon Sep 17 00:00:00 2001 From: Jacek Glen Date: Fri, 18 Oct 2024 21:06:41 +0200 Subject: [PATCH] Add ethereumjs build (#205) * Add support for Besu benchmark * Add ethereumjs build --- src/instrumentation_measurement/measurements.py | 16 +++++++++------- src/instrumentation_measurement/setup_clients.sh | 1 + src/instrumentation_measurement/setup_tools.sh | 11 ++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/instrumentation_measurement/measurements.py b/src/instrumentation_measurement/measurements.py index 22005b2..a4af637 100644 --- a/src/instrumentation_measurement/measurements.py +++ b/src/instrumentation_measurement/measurements.py @@ -18,7 +18,7 @@ DEFAULT_EXEC_NETHERMIND = '../../../gas-cost-estimator-clients/build/nethermind/Nethermind.Benchmark.Runner' DEFAULT_EXEC_ERIGON = '../../../gas-cost-estimator-clients/build/erigon/evm' DEFAULT_EXEC_REVM = '../../../gas-cost-estimator-clients/build/revm/revme' -DEFAULT_EXEC_ETHERJS = '../../../gas-cost-estimator-clients/ethereumjs-monorepo/packages/vm/benchmarks/run.js' +DEFAULT_EXEC_ETHERJS = '../../../gas-cost-estimator-clients/build/ethereumjs/index.js' DEFAULT_EXEC_BESU = '../../../gas-cost-estimator-clients/build/besu/evmtool/bin/evmtool' @@ -111,11 +111,7 @@ def measure(self, sample_size=1, evm="evmone", input_file="", exec_path=""): header = "program_id,sample_id,total_time_ns,iterations_count" elif evm == nethermind: header = "program_id,sample_id,total_time_ns,iterations_count,std_dev_time_ns,mem_allocs,mem_alloc_bytes" - elif evm == ethereumjs: - header = "program_id,sample_id,total_time_ns,iterations_count,margin_of_error" - elif evm == revm: - header = "program_id,sample_id,total_time_ns,iterations_count,std_dev_time_ns" - elif evm == besu: + elif evm == ethereumjs or evm == revm or evm == besu: header = "program_id,sample_id,total_time_ns,iterations_count,std_dev_time_ns" print(header) @@ -295,8 +291,14 @@ def run_ethereumjs_benchmark(self, program, sample_size, exec_path): line_id = 1 for line in raw_result: line_values = line.split(',') + + if line_values[4].startswith('±') and line_values[4].endswith('%'): + std_dev_ns = (float(line_values[4][1:-1]) * float(line_values[3])) / 100 + else : + std_dev_ns = line_values[4] + instrumenter_result.append( - f'{line_id},{line_values[3]},{line_values[5]},{line_values[4]}') + f'{line_id},{line_values[3]},{line_values[5]},{std_dev_ns}') line_id += 1 return instrumenter_result diff --git a/src/instrumentation_measurement/setup_clients.sh b/src/instrumentation_measurement/setup_clients.sh index 2c7772b..6a2ff7b 100755 --- a/src/instrumentation_measurement/setup_clients.sh +++ b/src/instrumentation_measurement/setup_clients.sh @@ -45,6 +45,7 @@ if [ ! -d "ethereumjs-monorepo" ]; then npm i cd packages/vm npm run build:benchmarks + ncc build benchmarks/run.js -o ../../../build/ethereumjs/ cd ../../.. fi diff --git a/src/instrumentation_measurement/setup_tools.sh b/src/instrumentation_measurement/setup_tools.sh index b2f964f..8c10eea 100755 --- a/src/instrumentation_measurement/setup_tools.sh +++ b/src/instrumentation_measurement/setup_tools.sh @@ -1,13 +1,18 @@ # install .NET 7.0 wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh chmod +x ./dotnet-install.sh -./dotnet-install.sh --channel 7.0 +sudo ./dotnet-install.sh --channel 7.0 rm ./dotnet-install.sh # install go sudo snap install go --classic # install rust -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - +sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +# install node +sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash +sudo nvm install 20 +node -v +npm -v +sudo npm i -g @vercel/ncc