Redesign and harden string interning.
Up to 40% faster on hash-intensive benchmarks. With some ideas from Sokolov Yura.
This commit is contained in:
@@ -20,8 +20,12 @@ LJ_FUNC int lj_str_haspattern(GCstr *s);
|
||||
LJ_FUNC void lj_str_resize(lua_State *L, MSize newmask);
|
||||
LJ_FUNCA GCstr *lj_str_new(lua_State *L, const char *str, size_t len);
|
||||
LJ_FUNC void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s);
|
||||
LJ_FUNC void LJ_FASTCALL lj_str_init(lua_State *L);
|
||||
#define lj_str_freetab(g) \
|
||||
(lj_mem_freevec(g, g->str.tab, g->str.mask+1, GCRef))
|
||||
|
||||
#define lj_str_newz(L, s) (lj_str_new(L, s, strlen(s)))
|
||||
#define lj_str_newlit(L, s) (lj_str_new(L, "" s, sizeof(s)-1))
|
||||
#define lj_str_size(len) (sizeof(GCstr) + (((len)+4) & ~(MSize)3))
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user