[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: string hash
- From: Richter, Jörg <Joerg.Richter@...>
- Date: Thu, 13 Dec 2012 07:21:08 +0000
> 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
After reading this I applied the same optimization to my hash table
implementation.
Are you sure this is worthwhile? My unrepresentative performance tests are
somewhat slower (2-3%) than without this extra compare.
But I have no performance tests for Lua to double check.
Perhaps anyone can run their tests with "h == ts->tsv.hash &&" commented out.
Jörg