Skip to content

Conversation

@MegaRedHand
Copy link
Collaborator

@MegaRedHand MegaRedHand commented Nov 12, 2025

Motivation

We are spending time copying bytes from the database when reading an account's code. This isn't ideal, since RocksDB already allows us to borrow the bytes without copying them.

Description

This PR implementation adds an owned version of the DBPinnableSlice type that RocksDB has, which packs it with a reference to the DB and allows us to wrap it with Bytes and treat it in a generic manner.

@github-actions github-actions bot added L1 Ethereum client performance Block execution throughput and performance in general labels Nov 12, 2025
@github-actions
Copy link

github-actions bot commented Nov 12, 2025

Lines of code report

Total lines added: 35
Total lines removed: 0
Total lines changed: 35

Detailed view
+-------------------------------------------+-------+------+
| File                                      | Lines | Diff |
+-------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/rocksdb.rs | 1687  | +35  |
+-------------------------------------------+-------+------+

Base automatically changed from pinned_get_code to main November 12, 2025 16:33
@github-actions
Copy link

github-actions bot commented Nov 12, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 59.690 ± 0.296 59.312 60.190 1.00 ± 0.01
head 59.656 ± 0.214 59.376 60.014 1.00

@MegaRedHand
Copy link
Collaborator Author

Since we added the code cache in #5307, this isn't needed anymore

@github-project-automation github-project-automation bot moved this from Todo to Done in ethrex_performance Nov 25, 2025
@MegaRedHand MegaRedHand deleted the avoid-copying-bytecode branch November 25, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client performance Block execution throughput and performance in general

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants