From eb983c88c6d5d61b53a72fc982afe3dcec0fa1e5 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Mon, 12 May 2025 23:31:04 +0300 Subject: [PATCH] reserve capacity for memo hashmap entries --- core/translate/optimizer/join.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/translate/optimizer/join.rs b/core/translate/optimizer/join.rs index 5f9caa3a5..b7e3c0255 100644 --- a/core/translate/optimizer/join.rs +++ b/core/translate/optimizer/join.rs @@ -177,7 +177,8 @@ pub fn compute_best_join_order<'a>( // if we find that 'b JOIN a' is better than 'a JOIN b', then we don't need to even try // to do 'a JOIN b JOIN c', because we know 'b JOIN a JOIN c' is going to be better. // This is due to the commutativity and associativity of inner joins. - let mut best_plan_memo: HashMap = HashMap::new(); + let mut best_plan_memo: HashMap = + HashMap::with_capacity(2usize.pow(num_tables as u32 - 1)); // Dynamic programming base case: calculate the best way to access each single table, as if // there were no other tables.