lua-users home
lua-l archive

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


On Fri, Apr 30, 2010 at 8:00 PM, Bulat Ziganshin
<bulat.ziganshin@gmail.com> wrote:
> btw, it may be rather meaningless :)  if string isn't in L2 cache
> then L2 cache line typically is 64 bytes long so accessing every 32'th
> byte means accessing every memory line and this needs about the same
> time as computations required to compute hash value

The code is accessing (upto) 32 bytes in total, not every 32nd byte.
e.g. for a 1MB string, just 32 bytes are visited for the hash rather
than 32768 bytes (1024*1024/32). If you're writing a Lua VM with cache
efficiency in mind (see Kore) then tweaking this string hash may be
one the things looked at, but generally I don't think it is much of a
concern.