Skip to content

Commit

Permalink
chore: add EOF benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Jul 24, 2024
1 parent 184d353 commit cd4d7fd
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ paste = "1.0"

[profile.release]
opt-level = 3
lto = "thin"
lto = true
debug = "line-tables-only"
strip = true
panic = "abort"
codegen-units = 16
codegen-units = 1

# Use the `--profile profiling` flag to show symbols in release mode.
# e.g. `cargo build --profile profiling`
Expand Down
10 changes: 5 additions & 5 deletions crates/revmc-cli/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use revmc::{llvm, EvmCompiler, EvmCompilerFn, EvmContext, EvmLlvmBackend, EvmSta
use revmc_cli::Bench;
use std::time::Duration;

const SPEC_ID: SpecId = SpecId::CANCUN;
const SPEC_ID: SpecId = SpecId::PRAGUE_EOF;

fn bench(c: &mut Criterion) {
for bench in &revmc_cli::get_benches() {
run_bench(c, bench);
if matches!(bench.name, "hash_10k") {
if matches!(bench.name, "hash_10k-eof") {
break;
}
}
Expand Down Expand Up @@ -110,9 +110,9 @@ fn run_bench(c: &mut Criterion, bench: &Bench) {

fn mk_group<'a>(c: &'a mut Criterion, name: &str) -> BenchmarkGroup<'a, WallTime> {
let mut g = c.benchmark_group(name);
g.sample_size(50);
g.warm_up_time(Duration::from_secs(5));
g.measurement_time(Duration::from_secs(15));
g.sample_size(20);
g.warm_up_time(Duration::from_secs(2));
g.measurement_time(Duration::from_secs(5));
g
}

Expand Down
14 changes: 9 additions & 5 deletions crates/revmc-cli/benches/iai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ fn setup_group(group: &mut BinaryBenchmarkGroup, is_ct: bool) {
run
};
let benches = [
("fibonacci", true),
("counter", true),
// ("fibonacci", true),
// ("counter", true),
// ("hash_10k", true),
// ("bswap64", true),
// ("usdc_proxy", false),
// ("weth", false),
("hash_10k", true),
("bswap64", true),
("usdc_proxy", false),
("weth", false),
("hash_10k-eof", true),
("snailtracer", true),
("snailtracer-eof", true),
];
for (bench, small) in benches {
if !is_ct && !small {
Expand Down
14 changes: 14 additions & 0 deletions crates/revmc-cli/src/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ pub fn get_benches() -> Vec<Bench> {
calldata: hex!("30627b7c").to_vec(),
..Default::default()
},
Bench {
name: "snailtracer-eof",
bytecode: include_code_str!("../../../data/snailtracer-eof.rt.hex").unwrap(),
// `Benchmark()`
calldata: hex!("30627b7c").to_vec(),
..Default::default()
},
Bench {
name: "weth",
bytecode: include_code_str!("../../../data/weth.rt.hex").unwrap(),
Expand All @@ -81,6 +88,13 @@ pub fn get_benches() -> Vec<Bench> {
calldata: hex!("30627b7c").to_vec(),
..Default::default()
},
Bench {
name: "hash_10k-eof",
bytecode: include_code_str!("../../../data/hash_10k-eof.rt.hex").unwrap(),
// `Benchmark()`
calldata: hex!("30627b7c").to_vec(),
..Default::default()
},
Bench {
name: "erc20_transfer",
bytecode: include_code_str!("../../../data/erc20_transfer.rt.hex").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion crates/revmc-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct Cli {
out_dir: Option<PathBuf>,
#[arg(short = 'O', long, default_value = "3")]
opt_level: OptimizationLevel,
#[arg(long, value_enum, default_value = "cancun")]
#[arg(long, value_enum, default_value = "pragueeof")]
spec_id: SpecIdValueEnum,
/// Short-hand for `--spec-id pragueeof`.
#[arg(long, conflicts_with = "spec_id")]
Expand Down
1 change: 1 addition & 0 deletions data/hash_10k-eof.rt.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ef000101000402000100c604006d000080000760806040526004361015e100035f80fd5f3560e01c6330627b7c1415e1ffee34e100a05f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112e100755f806127108210e1000a602090604051908152f3604051906020820190815260208252604082019180831067ffffffffffffffff841117e1000f600192604052519020910190e0ffb97f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5f80fd5f80fda3646970667358221220cd27a637eeed27ea6b9fcdffcb8a7ffd83e1bf9bc5cfc0df27c8617a28d6a8c06c6578706572696d656e74616cf564736f6c63782c302e382e32372d646576656c6f702e323032342e372e32342b636f6d6d69742e64353139363430342e6d6f64006b
1 change: 1 addition & 0 deletions data/snailtracer-eof.rt.hex

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion data/snailtracer.hex

This file was deleted.

2 changes: 1 addition & 1 deletion data/snailtracer.rt.hex

Large diffs are not rendered by default.

0 comments on commit cd4d7fd

Please sign in to comment.