Skip to content

Conversation

edg-l
Copy link
Contributor

@edg-l edg-l commented Aug 26, 2025

Minor improvements:

  • In fill_with_zeros, when the size is already target or more avoid allocating a vec.
  • Also avoided allocating vecs in other contexts.
  • Improved further the modexp code, making it more predictable to compiler optimizations.
  • Changed some infallible functions from returning a Result to a value directly.

Need to measure if it improves.

image

when the size is already target or more, some other minor changes to
avoid allocating vecs.
Copy link

github-actions bot commented Aug 26, 2025

Lines of code report

Total lines added: 19
Total lines removed: 0
Total lines changed: 19

Detailed view
+------------------------------------------+-------+------+
| File                                     | Lines | Diff |
+------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/errors.rs      | 217   | +5   |
+------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs | 1080  | +14  |
+------------------------------------------+-------+------+

Copy link

github-actions bot commented Aug 26, 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.180 ± 0.016 3.164 3.217 1.00 ± 0.01
main_levm_BubbleSort 3.517 ± 0.024 3.488 3.566 1.11 ± 0.01
pr_revm_BubbleSort 3.176 ± 0.026 3.148 3.240 1.00
pr_levm_BubbleSort 3.525 ± 0.039 3.489 3.619 1.11 ± 0.02

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.047 ± 0.007 1.041 1.063 1.01 ± 0.01
main_levm_ERC20Approval 1.203 ± 0.006 1.194 1.211 1.16 ± 0.01
pr_revm_ERC20Approval 1.034 ± 0.011 1.023 1.056 1.00
pr_levm_ERC20Approval 1.200 ± 0.010 1.181 1.213 1.16 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 136.2 ± 1.0 135.2 138.5 1.00
main_levm_ERC20Mint 167.3 ± 2.0 165.7 172.8 1.23 ± 0.02
pr_revm_ERC20Mint 138.0 ± 3.6 136.0 147.7 1.01 ± 0.03
pr_levm_ERC20Mint 165.6 ± 1.2 164.5 168.3 1.22 ± 0.01

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 246.3 ± 13.1 241.0 283.6 1.02 ± 0.05
main_levm_ERC20Transfer 295.2 ± 1.7 292.4 297.7 1.22 ± 0.01
pr_revm_ERC20Transfer 241.8 ± 1.1 240.6 243.9 1.00
pr_levm_ERC20Transfer 295.8 ± 2.3 293.0 301.1 1.22 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 229.1 ± 1.9 227.6 232.7 1.00
main_levm_Factorial 313.8 ± 2.4 310.8 319.9 1.37 ± 0.02
pr_revm_Factorial 230.4 ± 1.9 228.9 234.8 1.01 ± 0.01
pr_levm_Factorial 312.5 ± 3.4 310.2 321.8 1.36 ± 0.02

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.580 ± 0.068 1.407 1.638 1.00 ± 0.05
main_levm_FactorialRecursive 6.995 ± 0.028 6.956 7.055 4.45 ± 0.09
pr_revm_FactorialRecursive 1.573 ± 0.030 1.524 1.612 1.00
pr_levm_FactorialRecursive 6.989 ± 0.011 6.970 7.000 4.44 ± 0.09

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 200.1 ± 0.4 199.5 200.8 1.00
main_levm_Fibonacci 300.8 ± 4.8 297.1 313.5 1.50 ± 0.02
pr_revm_Fibonacci 207.8 ± 14.0 200.8 240.4 1.04 ± 0.07
pr_levm_Fibonacci 299.2 ± 3.4 296.5 307.5 1.50 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 841.4 ± 16.8 815.3 868.8 1.00
main_levm_FibonacciRecursive 1117.2 ± 15.5 1103.9 1158.0 1.33 ± 0.03
pr_revm_FibonacciRecursive 843.1 ± 9.1 825.9 851.9 1.00 ± 0.02
pr_levm_FibonacciRecursive 1125.8 ± 18.2 1104.7 1153.8 1.34 ± 0.03

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.5 ± 0.0 8.5 8.6 1.00
main_levm_ManyHashes 10.4 ± 0.1 10.3 10.6 1.22 ± 0.01
pr_revm_ManyHashes 8.5 ± 0.1 8.5 8.7 1.00 ± 0.01
pr_levm_ManyHashes 10.3 ± 0.0 10.2 10.3 1.20 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 265.0 ± 1.3 262.8 267.3 1.00
main_levm_MstoreBench 792.5 ± 1.9 790.5 796.9 2.99 ± 0.02
pr_revm_MstoreBench 265.3 ± 3.1 262.9 272.3 1.00 ± 0.01
pr_levm_MstoreBench 791.3 ± 2.2 789.3 796.6 2.99 ± 0.02

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 288.9 ± 0.7 288.0 290.5 1.00
main_levm_Push 920.5 ± 1.7 918.8 924.1 3.19 ± 0.01
pr_revm_Push 290.1 ± 1.3 287.7 291.8 1.00 ± 0.01
pr_levm_Push 921.8 ± 5.1 916.6 934.6 3.19 ± 0.02

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 157.3 ± 0.9 156.2 159.2 1.94 ± 0.05
main_levm_SstoreBench_no_opt 81.3 ± 1.1 80.2 83.3 1.00 ± 0.03
pr_revm_SstoreBench_no_opt 157.2 ± 0.8 156.2 158.2 1.94 ± 0.05
pr_levm_SstoreBench_no_opt 81.2 ± 2.3 79.7 87.1 1.00

@edg-l edg-l changed the title perf(levm): minor improvements to precompiles perf(levm): improvements to precompiles Aug 26, 2025
Copy link

github-actions bot commented Aug 26, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 161.445 ± 1.033 160.082 162.854 1.00 ± 0.01
head 161.237 ± 0.748 160.116 162.506 1.00

@edg-l edg-l marked this pull request as ready for review August 27, 2025 15:20
@edg-l edg-l requested a review from a team as a code owner August 27, 2025 15:20
@edg-l edg-l moved this from In Progress to In review in ethrex_performance Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

1 participant