Skip to content

Conversation

edg-l
Copy link
Contributor

@edg-l edg-l commented Oct 13, 2025

Motivation

This should enable better optimizations from the compiler since it will use a known type: Vec, instead of the dynamic fat pointer from the bufmut trait.

I looked at all the source code, and we are using a trait when we always passa Vec here. So the trait overhead is essentially useless.

Description

Remove the bufmut trait usage, use a Vec directly

This is the first pr im doing as i look to improve the rlp encoding/decoding, since its a known overhead now.

Copy link

Lines of code report

Total lines added: 1
Total lines removed: 5
Total lines changed: 6

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/common/trie/rlp.rs             | 123   | +1   |
+----------------------------------------------+-------+------+
| ethrex/crates/common/types/transaction.rs    | 2833  | -4   |
+----------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/message.rs | 294   | -1   |
+----------------------------------------------+-------+------+

@edg-l edg-l moved this from Todo to In review in ethrex_performance Oct 13, 2025
Copy link

Benchmark for 24a127a

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 35.1±0.50ms 35.0±0.73ms -0.28%
Trie/cita-trie insert 1k 3.6±0.03ms 3.5±0.13ms -2.78%
Trie/ethrex-trie insert 10k 54.7±0.37ms 53.7±0.33ms -1.83%
Trie/ethrex-trie insert 1k 6.2±0.04ms 6.0±0.18ms -3.23%

@edg-l edg-l removed this from ethrex_l1 Oct 13, 2025
Copy link

Benchmark for 809effe

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 30.8±1.05ms 30.5±0.76ms -0.97%
Trie/cita-trie insert 1k 2.8±0.01ms 2.9±0.14ms +3.57%
Trie/ethrex-trie insert 10k 55.2±1.25ms 54.9±1.24ms -0.54%
Trie/ethrex-trie insert 1k 5.7±0.01ms 5.6±0.01ms -1.75%

Copy link

github-actions bot commented Oct 14, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 86.973 ± 0.478 86.260 87.890 1.00
head 87.231 ± 0.462 86.495 87.709 1.00 ± 0.01

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@edg-l edg-l force-pushed the improve_encoding_rlp branch from b4ba2e2 to 76d1b6e Compare October 14, 2025 12:07
Copy link

Benchmark for 6f0961a

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 34.3±0.54ms 34.6±0.19ms +0.87%
Trie/cita-trie insert 1k 3.6±0.02ms 3.5±0.02ms -2.78%
Trie/ethrex-trie insert 10k 54.3±0.31ms 53.6±0.55ms -1.29%
Trie/ethrex-trie insert 1k 6.1±0.02ms 6.1±0.14ms 0.00%

Copy link

Benchmark for 0138e9c

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 36.8±1.39ms 36.5±1.05ms -0.82%
Trie/cita-trie insert 1k 3.5±0.02ms 3.5±0.17ms 0.00%
Trie/ethrex-trie insert 10k 55.5±0.92ms 54.4±0.58ms -1.98%
Trie/ethrex-trie insert 1k 6.1±0.04ms 6.0±0.02ms -1.64%

@edg-l
Copy link
Contributor Author

edg-l commented Oct 14, 2025

closing as it doesn-t seem to improve the performance

@edg-l edg-l closed this Oct 14, 2025
@github-project-automation github-project-automation bot moved this from In review to Done in ethrex_performance Oct 14, 2025
@edg-l edg-l reopened this Oct 14, 2025
@edg-l edg-l moved this from Done to In Progress in ethrex_performance Oct 14, 2025
Copy link

Benchmark for 3a40715

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 34.7±0.36ms 34.7±0.19ms 0.00%
Trie/cita-trie insert 1k 3.6±0.02ms 3.5±0.14ms -2.78%
Trie/ethrex-trie insert 10k 54.7±0.41ms 53.6±1.17ms -2.01%
Trie/ethrex-trie insert 1k 6.1±0.02ms 6.0±0.04ms -1.64%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client performance

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant