From 63f2198ed1895b75bd19d2a37dd1f78b497d911e Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 23 Nov 2024 15:03:16 +0800 Subject: [PATCH] Update py_dict.c --- src/public/py_dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/public/py_dict.c b/src/public/py_dict.c index 529abc6f..5fbddb32 100644 --- a/src/public/py_dict.c +++ b/src/public/py_dict.c @@ -5,7 +5,7 @@ #include "pocketpy/objects/object.h" #include "pocketpy/interpreter/vm.h" -#define PK_DICT_MAX_COLLISION 3 +#define PK_DICT_MAX_COLLISION 4 static uint32_t Dict__next_cap(uint32_t cap) { switch(cap) { @@ -190,8 +190,8 @@ static bool Dict__set(Dict* self, py_TValue* key, py_TValue* val) { if(res == -1) return false; // error } // no empty slot found - if(self->capacity >= self->entries.length * 10) { - // raise error if we reach the minimum load factor (0.1) + if(self->capacity >= self->entries.length * 20) { + // raise error if we reach the minimum load factor (5%) return RuntimeError("dict has too much collision: %d/%d/%d", self->entries.length, self->entries.capacity,