Skip to content

Commit

Permalink
init first bench
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Jan 23, 2025
1 parent 2ee81b0 commit 12acb11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bins/revme/benches/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use revme::cmd::{
};

fn evm(c: &mut Criterion) {
// call analysis to init static data.
revme::cmd::bench::analysis::run();

for &bench_name in BenchName::ALL {
let cmd = MainCmd::Bench(bench::Cmd { name: bench_name });
c.bench_function(bench_name.as_str(), |b| {
Expand Down
13 changes: 11 additions & 2 deletions bins/revme/src/cmd/bench/analysis.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::time::Instant;

use database::{BenchmarkDB, BENCH_CALLER, BENCH_TARGET};
use revm::{
bytecode::Bytecode,
primitives::{bytes, hex, Bytes, TxKind},
transact_main, Context,
Context, ExecuteEvm,
};

const BYTES: &str = include_str!("analysis.hex");
Expand All @@ -20,5 +22,12 @@ pub fn run() {
//evm.env.tx.data = Bytes::from(hex::decode("30627b7c").unwrap());
tx.data = bytes!("8035F0CE");
});
let _ = transact_main(&mut context);

let time = Instant::now();
let _ = context.exec_previous();
println!("First init: {:?}", time.elapsed());

let time = Instant::now();
let _ = context.exec_previous();
println!("Run: {:?}", time.elapsed());
}

0 comments on commit 12acb11

Please sign in to comment.