Skip to content

Conversation

@iovoid
Copy link
Contributor

@iovoid iovoid commented Nov 14, 2025

Motivation

Currently Substate::add_accessed_slot takes about 3% of SLOAD. A couple of very similar structures also exist albeit with less impact.

Description

This switches from BTree to FxHash and always checks the current level first to prevent deep queries for hot values.

@iovoid iovoid requested a review from a team as a code owner November 14, 2025 20:17
@github-actions github-actions bot added levm Lambda EVM implementation performance Block execution throughput and performance in general labels Nov 14, 2025
@github-actions
Copy link

github-actions bot commented Nov 14, 2025

Lines of code report

Total lines added: 5
Total lines removed: 0
Total lines changed: 5

Detailed view
+---------------------------------+-------+------+
| File                            | Lines | Diff |
+---------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs | 460   | +5   |
+---------------------------------+-------+------+

@github-actions
Copy link

github-actions bot commented Nov 14, 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 2.963 ± 0.017 2.946 2.995 1.00
main_levm_BubbleSort 2.987 ± 0.037 2.950 3.080 1.01 ± 0.01
pr_revm_BubbleSort 2.968 ± 0.029 2.942 3.036 1.00 ± 0.01
pr_levm_BubbleSort 3.023 ± 0.010 3.002 3.033 1.02 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 972.1 ± 7.2 963.5 990.4 1.00
main_levm_ERC20Approval 1092.4 ± 6.0 1084.8 1102.9 1.12 ± 0.01
pr_revm_ERC20Approval 979.0 ± 11.7 967.0 999.2 1.01 ± 0.01
pr_levm_ERC20Approval 1099.0 ± 8.1 1086.8 1116.8 1.13 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 131.4 ± 1.2 129.9 134.1 1.00
main_levm_ERC20Mint 171.4 ± 3.5 167.7 180.0 1.30 ± 0.03
pr_revm_ERC20Mint 133.3 ± 1.3 131.4 135.5 1.01 ± 0.01
pr_levm_ERC20Mint 170.9 ± 1.5 168.9 174.2 1.30 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 229.4 ± 3.3 225.9 238.3 1.00
main_levm_ERC20Transfer 290.2 ± 7.1 283.3 304.9 1.26 ± 0.04
pr_revm_ERC20Transfer 230.3 ± 1.2 229.1 233.3 1.00 ± 0.02
pr_levm_ERC20Transfer 288.6 ± 2.9 285.0 294.6 1.26 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 222.9 ± 1.0 221.3 224.8 1.00 ± 0.01
main_levm_Factorial 269.5 ± 4.4 266.3 281.6 1.21 ± 0.02
pr_revm_Factorial 222.8 ± 1.1 221.1 224.4 1.00
pr_levm_Factorial 267.6 ± 5.2 263.8 281.5 1.20 ± 0.02

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.610 ± 0.030 1.571 1.663 1.00
main_levm_FactorialRecursive 8.448 ± 0.090 8.343 8.582 5.25 ± 0.11
pr_revm_FactorialRecursive 1.641 ± 0.036 1.594 1.688 1.02 ± 0.03
pr_levm_FactorialRecursive 8.442 ± 0.096 8.298 8.577 5.24 ± 0.11

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 203.7 ± 1.6 199.4 205.4 1.00 ± 0.01
main_levm_Fibonacci 259.8 ± 5.1 252.5 271.4 1.28 ± 0.03
pr_revm_Fibonacci 203.4 ± 1.1 201.0 205.1 1.00
pr_levm_Fibonacci 262.1 ± 6.1 251.8 276.9 1.29 ± 0.03

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 840.8 ± 12.5 826.0 863.6 1.14 ± 0.02
main_levm_FibonacciRecursive 749.6 ± 14.8 735.2 788.6 1.01 ± 0.02
pr_revm_FibonacciRecursive 846.0 ± 11.0 821.6 865.7 1.15 ± 0.02
pr_levm_FibonacciRecursive 738.6 ± 5.9 731.6 752.0 1.00

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.4 ± 0.1 8.3 8.6 1.00
main_levm_ManyHashes 9.3 ± 0.1 9.2 9.5 1.10 ± 0.01
pr_revm_ManyHashes 8.5 ± 0.1 8.4 8.6 1.01 ± 0.01
pr_levm_ManyHashes 9.5 ± 0.1 9.4 9.7 1.13 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 262.7 ± 5.0 260.1 276.7 1.10 ± 0.02
main_levm_MstoreBench 239.6 ± 1.3 237.5 241.5 1.00
pr_revm_MstoreBench 264.3 ± 5.0 260.5 277.4 1.10 ± 0.02
pr_levm_MstoreBench 240.3 ± 1.5 237.5 242.2 1.00 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 295.8 ± 1.4 293.6 298.2 1.00
main_levm_Push 302.0 ± 0.7 301.4 303.5 1.02 ± 0.01
pr_revm_Push 316.3 ± 73.3 292.3 525.0 1.07 ± 0.25
pr_levm_Push 301.6 ± 2.0 299.7 306.4 1.02 ± 0.01

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 168.9 ± 4.1 158.9 173.4 1.67 ± 0.08
main_levm_SstoreBench_no_opt 101.1 ± 4.7 97.4 108.2 1.00 ± 0.06
pr_revm_SstoreBench_no_opt 167.5 ± 6.8 159.0 181.6 1.66 ± 0.10
pr_levm_SstoreBench_no_opt 101.0 ± 4.3 96.3 107.7 1.00

@github-actions
Copy link

github-actions bot commented Nov 14, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 60.736 ± 0.512 59.940 61.539 1.01 ± 0.01
head 60.063 ± 0.376 59.484 60.692 1.00

@github-project-automation github-project-automation bot moved this to In Review in ethrex_l1 Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

levm Lambda EVM implementation performance Block execution throughput and performance in general

Projects

Status: In Review
Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants