perf(trie): preserve allocations in sparse trie wipe() (#21089)

This commit is contained in:
Doohyun Cho
2026-02-19 13:02:20 +09:00
committed by GitHub
parent 5c83eb0b06
commit 93d546a36d

View File

@@ -3045,7 +3045,8 @@ impl SparseSubtrie {
/// Removes all nodes and values from the subtrie, resetting it to a blank state
/// with only an empty root node. This is used when a storage root is deleted.
fn wipe(&mut self) {
self.nodes = HashMap::from_iter([(Nibbles::default(), SparseNode::Empty)]);
self.nodes.clear();
self.nodes.insert(Nibbles::default(), SparseNode::Empty);
self.inner.clear();
}