improve performance by using an inline locals array in hashmaps

This commit is contained in:
William Bell
2025-09-08 02:21:26 +01:00
parent 23c4a7ebd1
commit d46a6dc209
8 changed files with 60 additions and 27 deletions

View File

@@ -6,9 +6,12 @@
#ifndef HASHMAP_GC_H
#define HASHMAP_GC_H
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#define INLINE_HASHMAP_ARRAY_SIZE 3
struct node_GC {
uint64_t hash;
void *key;
@@ -18,7 +21,10 @@ struct node_GC {
};
struct hashmap_GC {
size_t size;
struct node_GC inline_values[INLINE_HASHMAP_ARRAY_SIZE];
size_t count;
size_t inline_count;
size_t hashmap_count;
size_t order;
struct node_GC **list;
};