table sizes don't need to be primes; power of 2 gives the same performance.

This commit is contained in:
Roberto Ierusalimschy
1999-11-26 16:59:20 -02:00
parent 790690a223
commit d015f1fc02
6 changed files with 37 additions and 40 deletions

4
lgc.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 1.32 1999/11/22 13:12:07 roberto Exp roberto $
** $Id: lgc.c,v 1.33 1999/11/23 13:58:02 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -208,7 +208,7 @@ static void collectstring (lua_State *L, int limit) {
}
}
if ((tb->nuse+1)*6 < tb->size)
luaS_grow(L, tb); /* table is too big; `grow' it to a smaller size */
luaS_resize(L, tb, tb->size/2); /* table is too big */
}
}