lua-users home
lua-l archive

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


Mike Pall writes:
> This is an experimental patch for fast(er) string hashing....
> Please post your findings!...
> I've found a ~5-10% speedup in benchmarks which create huge
> amounts of strings and (not suprisingly) no difference at all
> in other benchmarks. YMMV.

I applied this patch to my app that runs a variety of heavy numerical
computations in Lua (P4-SSE2/Lua 5.1.2/MSVC++2005 + optimizations on).  There's
not much string handling, so generally, I saw no significant difference.  So,
out of desperation, I ran this

  local char = string.char
  for i1=1,200 do
  for i2=1,200 do
  for i3=1,200 do
     local s = char(i1,i2,i3)
  end end end

and got ~8% speedup with the patch.  However, I did notice that one of my actual
runs did seem a bit slower with the patch.  I narrowed it down to this:

  t = {}
  function t.a() if 0 then end end
  function t.b() end
  function t.c() end
  function t.d() end
  for n=1,20000000 do t.a() t.b() end

That runs about 5% slower here with patch.