mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update py_dict.c
This commit is contained in:
parent
6eb785144e
commit
63f2198ed1
@ -5,7 +5,7 @@
|
|||||||
#include "pocketpy/objects/object.h"
|
#include "pocketpy/objects/object.h"
|
||||||
#include "pocketpy/interpreter/vm.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) {
|
static uint32_t Dict__next_cap(uint32_t cap) {
|
||||||
switch(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
|
if(res == -1) return false; // error
|
||||||
}
|
}
|
||||||
// no empty slot found
|
// no empty slot found
|
||||||
if(self->capacity >= self->entries.length * 10) {
|
if(self->capacity >= self->entries.length * 20) {
|
||||||
// raise error if we reach the minimum load factor (0.1)
|
// raise error if we reach the minimum load factor (5%)
|
||||||
return RuntimeError("dict has too much collision: %d/%d/%d",
|
return RuntimeError("dict has too much collision: %d/%d/%d",
|
||||||
self->entries.length,
|
self->entries.length,
|
||||||
self->entries.capacity,
|
self->entries.capacity,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user