Skip to content

perf(levm): codecopy perf improvement #3675

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

Merged
merged 51 commits into from
Jul 18, 2025
Merged

perf(levm): codecopy perf improvement #3675

merged 51 commits into from
Jul 18, 2025

Conversation

edg-l
Copy link
Contributor

@edg-l edg-l commented Jul 17, 2025

Motivation

Improves from 200 mgas to 790, this bench was made with this pr along memory, sstore and opcodes ones.

A 295% increase in perf.

Requires the pr #3564

Description

Copy link

github-actions bot commented Jul 17, 2025

Lines of code report

Total lines added: 11
Total lines removed: 0
Total lines changed: 11

Detailed view
+----------------------------------------------------------+-------+------+
| File                                                     | Lines | Diff |
+----------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/environment.rs | 319   | +11  |
+----------------------------------------------------------+-------+------+

Copy link

github-actions bot commented Jul 17, 2025

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.211 ± 0.017 3.195 3.243 1.00
main_levm_BubbleSort 4.162 ± 0.025 4.126 4.204 1.30 ± 0.01
pr_revm_BubbleSort 3.219 ± 0.009 3.207 3.232 1.00 ± 0.01
pr_levm_BubbleSort 4.242 ± 0.034 4.196 4.319 1.32 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.051 ± 0.004 1.047 1.060 1.00 ± 0.01
main_levm_ERC20Approval 1.425 ± 0.011 1.415 1.452 1.36 ± 0.02
pr_revm_ERC20Approval 1.048 ± 0.012 1.036 1.068 1.00
pr_levm_ERC20Approval 1.454 ± 0.011 1.437 1.468 1.39 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 138.0 ± 1.2 134.6 139.2 1.00
main_levm_ERC20Mint 209.3 ± 1.9 206.8 212.1 1.52 ± 0.02
pr_revm_ERC20Mint 138.6 ± 0.7 138.0 139.9 1.00 ± 0.01
pr_levm_ERC20Mint 210.2 ± 7.9 205.6 232.4 1.52 ± 0.06

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 245.1 ± 2.3 243.1 250.6 1.01 ± 0.01
main_levm_ERC20Transfer 361.2 ± 2.6 359.0 368.0 1.48 ± 0.01
pr_revm_ERC20Transfer 243.9 ± 1.1 242.5 245.9 1.00
pr_levm_ERC20Transfer 365.5 ± 3.4 361.7 371.9 1.50 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 230.8 ± 0.8 228.9 232.2 1.00
main_levm_Factorial 464.9 ± 11.0 455.8 490.5 2.01 ± 0.05
pr_revm_Factorial 232.5 ± 1.7 231.1 236.4 1.01 ± 0.01
pr_levm_Factorial 461.9 ± 10.0 453.9 485.4 2.00 ± 0.04

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.580 ± 0.075 1.373 1.646 1.00
main_levm_FactorialRecursive 8.255 ± 0.048 8.177 8.305 5.22 ± 0.25
pr_revm_FactorialRecursive 1.596 ± 0.045 1.536 1.677 1.01 ± 0.06
pr_levm_FactorialRecursive 8.296 ± 0.039 8.228 8.344 5.25 ± 0.25

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 205.7 ± 6.1 202.3 221.8 1.01 ± 0.03
main_levm_Fibonacci 461.9 ± 16.8 448.9 496.8 2.27 ± 0.08
pr_revm_Fibonacci 203.9 ± 0.6 203.1 204.7 1.00
pr_levm_Fibonacci 464.7 ± 16.7 449.5 500.1 2.28 ± 0.08

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 859.2 ± 26.8 832.9 930.2 1.00
main_levm_FibonacciRecursive 1329.9 ± 25.8 1291.9 1371.4 1.55 ± 0.06
pr_revm_FibonacciRecursive 864.6 ± 7.9 852.2 874.6 1.01 ± 0.03
pr_levm_FibonacciRecursive 1325.7 ± 18.3 1300.0 1354.4 1.54 ± 0.05

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.7 ± 0.0 8.7 8.8 1.00
main_levm_ManyHashes 12.2 ± 0.2 12.0 12.6 1.39 ± 0.02
pr_revm_ManyHashes 8.7 ± 0.1 8.6 8.9 1.00 ± 0.01
pr_levm_ManyHashes 12.2 ± 0.1 12.2 12.5 1.40 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 268.2 ± 3.1 264.6 274.0 1.01 ± 0.01
main_levm_MstoreBench 639.6 ± 2.6 636.2 645.1 2.40 ± 0.02
pr_revm_MstoreBench 266.0 ± 1.4 264.7 268.9 1.00
pr_levm_MstoreBench 640.2 ± 6.8 636.5 659.3 2.41 ± 0.03

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 290.9 ± 2.0 289.0 295.3 1.00
main_levm_Push 835.3 ± 15.9 825.4 875.5 2.87 ± 0.06
pr_revm_Push 291.0 ± 1.4 288.9 293.3 1.00 ± 0.01
pr_levm_Push 837.2 ± 18.8 827.5 890.4 2.88 ± 0.07

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 160.3 ± 0.9 159.1 161.9 1.59 ± 0.01
main_levm_SstoreBench_no_opt 101.1 ± 0.6 99.9 102.4 1.00
pr_revm_SstoreBench_no_opt 159.7 ± 1.6 157.5 161.4 1.58 ± 0.02
pr_levm_SstoreBench_no_opt 101.2 ± 1.2 98.6 102.4 1.00 ± 0.01

Base automatically changed from new_memory to main July 17, 2025 14:19
CHANGELOG.md Outdated
### 2025-07-16

- Improve levm memory model [#3564](https://github.com/lambdaclass/ethrex/pull/3564)
-
-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-

Copy link

github-actions bot commented Jul 17, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 209.680 ± 1.063 208.295 211.303 1.00 ± 0.01
head 209.611 ± 1.149 207.179 210.808 1.00

@edg-l edg-l enabled auto-merge July 18, 2025 04:49
@edg-l edg-l disabled auto-merge July 18, 2025 04:50
@edg-l edg-l enabled auto-merge July 18, 2025 04:53
@edg-l edg-l added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit 6876c91 Jul 18, 2025
42 of 47 checks passed
@edg-l edg-l deleted the codecopy_perf_improvement branch July 18, 2025 05:20
@github-project-automation github-project-automation bot moved this from Todo to Done in ethrex_performance Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants