From e7d4a05e36d44c3570136d69b950ed787db334b2 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Sun, 1 Feb 2026 22:58:45 -0800 Subject: [PATCH] perf(trie): fix allocation hot paths with capacity hints and buffer reuse (#21466) Co-authored-by: Amp Co-authored-by: yongkangc --- crates/trie/trie/src/proof_v2/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/trie/trie/src/proof_v2/mod.rs b/crates/trie/trie/src/proof_v2/mod.rs index 8861def8a5..0696ca1668 100644 --- a/crates/trie/trie/src/proof_v2/mod.rs +++ b/crates/trie/trie/src/proof_v2/mod.rs @@ -105,10 +105,10 @@ impl ProofCalculator { hashed_cursor, branch_stack: Vec::<_>::with_capacity(64), branch_path: Nibbles::new(), - child_stack: Vec::<_>::new(), + child_stack: Vec::<_>::with_capacity(64), cached_branch_stack: Vec::<_>::with_capacity(64), - retained_proofs: Vec::<_>::new(), - rlp_nodes_bufs: Vec::<_>::new(), + retained_proofs: Vec::<_>::with_capacity(32), + rlp_nodes_bufs: Vec::<_>::with_capacity(8), rlp_encode_buf: Vec::<_>::with_capacity(RLP_ENCODE_BUF_SIZE), } }