Skip to content

Conversation

@JereSalo
Copy link
Contributor

@JereSalo JereSalo commented Nov 28, 2025

Motivation

  • Improve perf with SP1

Description

Based on SP1 Docs we should compile with lto thin, true or fat and codegen-units 1.

Ethrex Replay Build Command: cargo build --release --profile sp1,profiling

Branch Empty 1 Transfer 100 Transfers 23897700 (30M) 23897687 (33M) 23897646 (55M) 23897709 (60M)
main (Gas) 6,395,981 7,562,712 45,607,202 992,588,338 1,636,706,753 2,403,112,555 1,592,397,865
this branch (Gas) 5,780,387 7,342,824 43,493,602 967,103,357 1,605,060,723 2,355,045,830 1,548,978,533
% improvement 9.62% 2.91% 4.63% 2.57% 1.93% 2.00% 2.73%
main (Cycles) 1,117,654 1,402,868 20,150,510 723,222,391 1,325,458,588 1,852,238,963 1,209,370,294
this branch (Cycles) 1,019,876 1,296,104 17,718,398 692,676,359 1,289,227,624 1,796,213,076 1,158,792,828
% improvement (Cycles) 8.75% 7.61% 12.07% 4.22% 2.73% 3.02% 4.18%

@github-actions github-actions bot added L2 Rollup client performance Block execution throughput and performance in general labels Nov 28, 2025
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

Lines of code report

Total lines added: 4
Total lines removed: 0
Total lines changed: 4

Detailed view
+----------------------------------------------------+-------+------+
| File                                               | Lines | Diff |
+----------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/guest_program/build.rs | 197   | +4   |
+----------------------------------------------------+-------+------+

@JereSalo JereSalo changed the title perf(l2): build sp1 with recommended settings perf(l2): build zkVMs with recommended settings Nov 29, 2025
@JereSalo JereSalo marked this pull request as ready for review November 29, 2025 00:02
Copilot AI review requested due to automatic review settings November 29, 2025 00:03
Copilot finished reviewing on behalf of JereSalo November 29, 2025 00:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces performance optimizations for zkVM builds by configuring the Cargo release profile with recommended compiler settings from the SP1 documentation. The changes set lto = "thin" and codegen-units = 1 to improve execution performance, resulting in 2-10% gas and cycle improvements across various test scenarios.

  • Added a helper function to configure Cargo profile environment variables for LTO and codegen optimization
  • Applied these settings consistently across all four zkVM backends (RISC0, SP1, Zisk, and OpenVM)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@JereSalo JereSalo requested a review from a team as a code owner December 1, 2025 20:10
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 61.183 ± 0.338 60.908 61.972 1.01 ± 0.01
head 60.837 ± 0.124 60.692 61.044 1.00

@JereSalo JereSalo changed the title perf(l2): build zkVMs with recommended settings perf(l2): build SP1 with recommended settings Dec 2, 2025
@JereSalo JereSalo changed the title perf(l2): build SP1 with recommended settings chore(l2): build SP1 with recommended settings Dec 4, 2025
@JereSalo JereSalo removed the performance Block execution throughput and performance in general label Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants