lua-users home
lua-l archive

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

Geoff Leyland wrote:
> It took a while to work out how to stop LuaJIT optimising out
> the loops altogether - it might still be optimising more than I
> want.  I'm sure this is not a good test, but for what it's
> worth:

Well, LuaJIT _is_ optimizing away all of the proxy overhead, of
course. :-)

But I was talking about Lua, not LuaJIT. And about hash keys, e.g.
strings. A pattern like this will show the worst case:

  p.x = 1; p.x = 1; p.y = 1; p.z = 1; p.z = 1; p.z = 1; p.y = 1;

This is 40%-50% slower with table-based proxies vs. userdata
proxies. The actual cost is much higher -- it's shadowed by the
interpreter overhead.