mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
refactor(trie): replace SmallVec with Vec in sparse trie buffers (#21637)
Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e1bc6d0f08
commit
3ec065295e
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -11255,7 +11255,6 @@ dependencies = [
|
||||
"reth-trie",
|
||||
"reth-trie-common",
|
||||
"reth-trie-db",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ reth-metrics = { workspace = true, optional = true }
|
||||
metrics = { workspace = true, optional = true }
|
||||
|
||||
# misc
|
||||
smallvec.workspace = true
|
||||
rayon = { workspace = true, optional = true }
|
||||
smallvec.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
# reth
|
||||
|
||||
@@ -3248,9 +3248,9 @@ pub struct SparseSubtrieBuffers {
|
||||
/// Stack of RLP nodes
|
||||
rlp_node_stack: Vec<RlpNodeStackItem>,
|
||||
/// Reusable branch child path
|
||||
branch_child_buf: SmallVec<[Nibbles; 16]>,
|
||||
branch_child_buf: Vec<Nibbles>,
|
||||
/// Reusable branch value stack
|
||||
branch_value_stack_buf: SmallVec<[RlpNode; 16]>,
|
||||
branch_value_stack_buf: Vec<RlpNode>,
|
||||
/// Reusable RLP buffer
|
||||
rlp_buf: Vec<u8>,
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ alloy-rlp.workspace = true
|
||||
# misc
|
||||
auto_impl.workspace = true
|
||||
rayon = { workspace = true, optional = true }
|
||||
smallvec = { workspace = true, features = ["const_new"] }
|
||||
|
||||
# metrics
|
||||
reth-metrics = { workspace = true, optional = true }
|
||||
@@ -80,7 +79,6 @@ arbitrary = [
|
||||
"alloy-trie/arbitrary",
|
||||
"reth-primitives-traits/arbitrary",
|
||||
"reth-trie-common/arbitrary",
|
||||
"smallvec/arbitrary",
|
||||
]
|
||||
|
||||
[[bench]]
|
||||
|
||||
@@ -24,7 +24,6 @@ use reth_trie_common::{
|
||||
LeafNodeRef, Nibbles, ProofTrieNode, RlpNode, TrieMask, TrieNode, CHILD_INDEX_RANGE,
|
||||
EMPTY_ROOT_HASH,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
/// The level below which the sparse trie hashes are calculated in
|
||||
@@ -2003,9 +2002,9 @@ pub struct RlpNodeBuffers {
|
||||
/// Stack of RLP nodes
|
||||
rlp_node_stack: Vec<RlpNodeStackItem>,
|
||||
/// Reusable branch child path
|
||||
branch_child_buf: SmallVec<[Nibbles; 16]>,
|
||||
branch_child_buf: Vec<Nibbles>,
|
||||
/// Reusable branch value stack
|
||||
branch_value_stack_buf: SmallVec<[RlpNode; 16]>,
|
||||
branch_value_stack_buf: Vec<RlpNode>,
|
||||
}
|
||||
|
||||
impl RlpNodeBuffers {
|
||||
@@ -2018,8 +2017,8 @@ impl RlpNodeBuffers {
|
||||
is_in_prefix_set: None,
|
||||
}],
|
||||
rlp_node_stack: Vec::new(),
|
||||
branch_child_buf: SmallVec::<[Nibbles; 16]>::new_const(),
|
||||
branch_value_stack_buf: SmallVec::<[RlpNode; 16]>::new_const(),
|
||||
branch_child_buf: Vec::new(),
|
||||
branch_value_stack_buf: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user