lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I'd like to know whether the (only) purpose of strings storing their hash 
> value is to avoid recomputing them when the string pool has to grow.

No. Strings are stored in a hash table but the string hash value is reduced
modulo the size of the hash table and so it helps to compare string hash
values for colliding strings before resorting to memcmp. See
	http://www.lua.org/source/5.2/lstring.c.html#luaS_newlstr

This is new in 5.2.