Skip to content

perf(levm): refactor libmdbx storage, removing unneeded rlp encoding #4020

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

edg-l
Copy link
Contributor

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

Motivation

Remove unneeded RLP encoding from key/values in libmdbx / redb storage

The database tables are completly private so we don't need to use rlp encoding at all, avoiding possible perfomance costs by storing as bytes directly where possible.

Complex types like entire blocks remain as RLP, future improvements could be made, like changing to a possibly more perfomant encoding like bincode.

Copy link

github-actions bot commented Aug 12, 2025

Lines of code report

Total lines added: 48
Total lines removed: 47
Total lines changed: 95

Detailed view
+-------------------------------------------+-------+------+
| File                                      | Lines | Diff |
+-------------------------------------------+-------+------+
| ethrex/crates/storage/rlp.rs              | 95    | -7   |
+-------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/libmdbx.rs | 1415  | -40  |
+-------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/mod.rs     | 35    | +30  |
+-------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/redb.rs    | 1288  | +18  |
+-------------------------------------------+-------+------+

@edg-l edg-l moved this from Todo to In Progress in ethrex_performance Aug 12, 2025
@edg-l edg-l marked this pull request as ready for review August 12, 2025 11:37
@edg-l edg-l requested a review from a team as a code owner August 12, 2025 11:37
Copy link

github-actions bot commented Aug 12, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 162.668 ± 0.585 161.563 163.504 1.01 ± 0.00
head 160.882 ± 0.528 159.901 161.352 1.00

@edg-l edg-l moved this from In Progress to In review in ethrex_performance Aug 12, 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