From 896377463f880fa653e49184f81ce1190d05e082 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 17 Nov 2022 15:25:45 -0700 Subject: [PATCH] [map] Don't resize map if not necessary --- src/hb-map.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-map.hh b/src/hb-map.hh index 3886449c8..94648b289 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -160,6 +160,8 @@ struct hb_hashmap_t { if (unlikely (!successful)) return false; + if (new_population != 0 && new_population <= population) return true; + unsigned int power = hb_bit_storage (hb_max (population, new_population) * 2 + 8); unsigned int new_size = 1u << power; item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t));