Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf: Add metrics to facilitate performance testing. #31

Open
wants to merge 1 commit into
base: perf-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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