reduce segment size and increase cache

This commit is contained in:
daan 2020-05-02 22:22:35 -07:00
parent ea92fb2fe4
commit e5b72cdfe7
2 changed files with 5 additions and 5 deletions

View file

@ -100,7 +100,7 @@ terms of the MIT license. A copy of the license can be found in the file
// Main tuning parameters for segment and page sizes // Main tuning parameters for segment and page sizes
// Sizes for 64-bit, divide by two for 32-bit // Sizes for 64-bit, divide by two for 32-bit
#define MI_SEGMENT_SLICE_SHIFT (13 + MI_INTPTR_SHIFT) // 64kb #define MI_SEGMENT_SLICE_SHIFT (13 + MI_INTPTR_SHIFT) // 64kb
#define MI_SEGMENT_SHIFT ( 8 + MI_SEGMENT_SLICE_SHIFT) // 16mb #define MI_SEGMENT_SHIFT ( 7 + MI_SEGMENT_SLICE_SHIFT) // 8mb
#define MI_SMALL_PAGE_SHIFT (MI_SEGMENT_SLICE_SHIFT) // 64kb #define MI_SMALL_PAGE_SHIFT (MI_SEGMENT_SLICE_SHIFT) // 64kb
#define MI_MEDIUM_PAGE_SHIFT ( 3 + MI_SMALL_PAGE_SHIFT) // 512kb #define MI_MEDIUM_PAGE_SHIFT ( 3 + MI_SMALL_PAGE_SHIFT) // 512kb

View file

@ -128,8 +128,8 @@ static bool mi_arena_alloc(mi_arena_t* arena, size_t blocks, mi_bitmap_index_t*
Arena cache Arena cache
----------------------------------------------------------- */ ----------------------------------------------------------- */
#define MI_CACHE_FIELDS (8) #define MI_CACHE_FIELDS (16)
#define MI_CACHE_MAX (MI_BITMAP_FIELD_BITS*MI_CACHE_FIELDS) // 512 on 64-bit #define MI_CACHE_MAX (MI_BITMAP_FIELD_BITS*MI_CACHE_FIELDS) // 1024 on 64-bit
typedef struct mi_cache_slot_s { typedef struct mi_cache_slot_s {
void* p; void* p;
@ -141,8 +141,8 @@ typedef struct mi_cache_slot_s {
static mi_cache_slot_t cache[MI_CACHE_MAX]; // = 0 static mi_cache_slot_t cache[MI_CACHE_MAX]; // = 0
#define BITS_SET() (UINTPTR_MAX) #define BITS_SET() (UINTPTR_MAX)
static mi_bitmap_field_t cache_available[MI_CACHE_FIELDS] = { MI_INIT8(BITS_SET) }; // zero bit = available! static mi_bitmap_field_t cache_available[MI_CACHE_FIELDS] = { MI_INIT16(BITS_SET) }; // zero bit = available!
static mi_bitmap_field_t cache_available_large[MI_CACHE_FIELDS] = { MI_INIT8(BITS_SET) }; static mi_bitmap_field_t cache_available_large[MI_CACHE_FIELDS] = { MI_INIT16(BITS_SET) };
static mi_bitmap_field_t cache_inuse[MI_CACHE_FIELDS]; // zero bit = free static mi_bitmap_field_t cache_inuse[MI_CACHE_FIELDS]; // zero bit = free