From 93d546a36dab041fd6816ad3dff476e3fd42f5d8 Mon Sep 17 00:00:00 2001 From: Doohyun Cho <158799614+doocho@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:02:20 +0900 Subject: [PATCH] perf(trie): preserve allocations in sparse trie wipe() (#21089) --- crates/trie/sparse/src/parallel.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/trie/sparse/src/parallel.rs b/crates/trie/sparse/src/parallel.rs index 20c0e972c5..765e8b074b 100644 --- a/crates/trie/sparse/src/parallel.rs +++ b/crates/trie/sparse/src/parallel.rs @@ -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(); }