Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 443d16f

Browse files
dawkshmattsse
andauthored
perf: iterate through nibbles (paradigmxyz#17820)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
1 parent 810790c commit 443d16f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ linked_hash_set = "0.1"
546546
lz4 = "1.28.1"
547547
modular-bitfield = "0.11.2"
548548
notify = { version = "8.0.0", default-features = false, features = ["macos_fsevent"] }
549-
nybbles = { version = "0.4.0", default-features = false }
549+
nybbles = { version = "0.4.2", default-features = false }
550550
once_cell = { version = "1.19", default-features = false, features = ["critical-section"] }
551551
parking_lot = "0.12"
552552
paste = "1.0"

crates/trie/common/src/nibbles.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ impl reth_codecs::Compact for StoredNibbles {
2828
where
2929
B: bytes::BufMut + AsMut<[u8]>,
3030
{
31-
buf.put_slice(&self.0.to_vec());
31+
for i in self.0.iter() {
32+
buf.put_u8(i);
33+
}
3234
self.0.len()
3335
}
3436

@@ -77,7 +79,9 @@ impl reth_codecs::Compact for StoredNibblesSubKey {
7779
assert!(self.0.len() <= 64);
7880

7981
// right-pad with zeros
80-
buf.put_slice(&self.0.to_vec());
82+
for i in self.0.iter() {
83+
buf.put_u8(i);
84+
}
8185
static ZERO: &[u8; 64] = &[0; 64];
8286
buf.put_slice(&ZERO[self.0.len()..]);
8387

0 commit comments

Comments
 (0)