From 868aa4c14ab6c63b9b797f4a8178c73b69897711 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 14 Jan 2023 12:58:45 +0000 Subject: Minor changes to `StringMap` allocation --- src/string_map.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/string_map.cpp') diff --git a/src/string_map.cpp b/src/string_map.cpp index 3bd08d09f..067adef28 100644 --- a/src/string_map.cpp +++ b/src/string_map.cpp @@ -1,5 +1,11 @@ GB_STATIC_ASSERT(sizeof(MapIndex) == sizeof(u32)); +enum { + STRING_MAP_CACHE_LINE_SIZE_POW = 6, + STRING_MAP_CACHE_LINE_SIZE = 1< *h) { template gb_internal void string_map__resize_hashes(StringMap *h, usize count) { - h->hashes_count = cast(u32)resize_array_raw(&h->hashes, string_map_allocator(), h->hashes_count, count); + h->hashes_count = cast(u32)resize_array_raw(&h->hashes, string_map_allocator(), h->hashes_count, count, STRING_MAP_CACHE_LINE_SIZE); } template gb_internal void string_map__reserve_entries(StringMap *h, usize capacity) { - h->entries_capacity = cast(u32)resize_array_raw(&h->entries, string_map_allocator(), h->entries_capacity, capacity); + h->entries_capacity = cast(u32)resize_array_raw(&h->entries, string_map_allocator(), h->entries_capacity, capacity, STRING_MAP_CACHE_LINE_SIZE); } -- cgit v1.2.3