Commit 3e4d1e8
perf(l1): improve rlp encoding (#5350)
**Motivation**
- In the current impl_encode there are 2 loops to get the position,
fixed to a single pass.
- Added specialized branchless length methods to integers,
- Added specialized length to Vec<T>
- Added specialized length to tuples
- Added specialized length to most types in ethrex-common, only ones
missing are in networking/p2p
- Removed unneeded arrayvec usage
- Many instances that deref to &[u8] didn't use its length specialized
method, fixed to use it
Each missing length impl in the trait impl meant an extra allocation,
this should remove them entirely when encoding
Helps with #4956
---------
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>1 parent 7b4a0ba commit 3e4d1e8
File tree
3 files changed
+507
-160
lines changed- crates/common/rlp
- tooling
3 files changed
+507
-160
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
0 commit comments