From 57d9380a53ce1dca620535dcea4b314937d5e95e Mon Sep 17 00:00:00 2001 From: Arnold Loubriat Date: Thu, 21 Nov 2024 20:23:43 +0100 Subject: [PATCH] fix: Avoid reallocations when processing tree updates --- consumer/src/tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consumer/src/tree.rs b/consumer/src/tree.rs index c66f45c2..f4768988 100644 --- a/consumer/src/tree.rs +++ b/consumer/src/tree.rs @@ -76,7 +76,7 @@ impl State { orphans.remove(&node_id); - let mut seen_child_ids = HashSet::new(); + let mut seen_child_ids = HashSet::with_capacity(node_data.children().len()); for (child_index, child_id) in node_data.children().iter().enumerate() { if seen_child_ids.contains(child_id) { panic!(