Skip to content

Commit

Permalink
Perf: Add metrics to facilitate performance testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousGiga committed Mar 13, 2024
1 parent dee3c77 commit 5c66064
Show file tree
Hide file tree
Showing 23 changed files with 476 additions and 69 deletions.
35 changes: 35 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ default-members = ["crates/revm"]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace.dependencies]
revm-utils = { git = "https://github.com/megaeth-labs/reth-perf-utils.git" }

[profile.release]
lto = true
codegen-units = 1
Expand Down
3 changes: 3 additions & 0 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde = { version = "1.0", default-features = false, features = [
"derive",
"rc",
], optional = true }
revm-utils = { workspace = true, optional = true }

[features]
default = ["std"]
Expand Down Expand Up @@ -55,3 +56,5 @@ optional_eip3607 = ["revm-primitives/optional_eip3607"]
optional_gas_refund = ["revm-primitives/optional_gas_refund"]
optional_no_base_fee = ["revm-primitives/optional_no_base_fee"]
optional_beneficiary_reward = ["revm-primitives/optional_beneficiary_reward"]
enable_opcode_metrics = ["revm-utils"]
enable_cache_record = ["revm-primitives/enable_cache_record"]
5 changes: 4 additions & 1 deletion crates/interpreter/src/instructions/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ pub fn mulmod<H: Host>(interpreter: &mut Interpreter, _host: &mut H) {

pub fn exp<H: Host, SPEC: Spec>(interpreter: &mut Interpreter, _host: &mut H) {
pop_top!(interpreter, op1, op2);
gas_or_fail!(interpreter, gas::exp_cost::<SPEC>(*op2));
let cost = gas::exp_cost::<SPEC>(*op2);
gas_or_fail!(interpreter, cost);
#[cfg(feature = "enable_opcode_metrics")]
revm_utils::metrics::record_gas(crate::opcode::EXP, cost.unwrap_or(0));
*op2 = op1.pow(*op2);
}

Expand Down
Loading

0 comments on commit 5c66064

Please sign in to comment.