Skip to content

Commit e6cde07

Browse files
committed
Make initial shape hash table bigger
Even an empty script requires more than 16 entries in the hash table. Before this commit, executing an empty script caused the hash table to resize two times. Now, it's the proper size from the start and not resized at all.
1 parent 0191aea commit e6cde07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quickjs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4430,7 +4430,7 @@ static inline JSShapeProperty *get_shape_prop(JSShape *sh)
44304430

44314431
static int init_shape_hash(JSRuntime *rt)
44324432
{
4433-
rt->shape_hash_bits = 4; /* 16 shapes */
4433+
rt->shape_hash_bits = 6; /* 64 shapes */
44344434
rt->shape_hash_size = 1 << rt->shape_hash_bits;
44354435
rt->shape_hash_count = 0;
44364436
rt->shape_hash = js_mallocz_rt(rt, sizeof(rt->shape_hash[0]) *

0 commit comments

Comments
 (0)