lua-users home
lua-l archive

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


Wim Couwenberg wrote:
And on a more trivial note: if you use table.insert in a loop, make it a
local first.  This saves two table lookups per iteration.

I think that's true, and probably a fair optimization for
this inner loop -- but in the general case I don't think
it's an optimization worth bothing with in Lua5 -- right?

I think that the speed improvement from a local-cached
function reference is barely measurable now, at least when I
did a halfhearted test.  I suppose something improved a lot
in Lua5, and/or it does this automagically (but that doesn't
sound likely).

--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
"When I was young, I would break down and cry whenever mom made me
throw an empty toilet paper tube in the trash can. I just imagined
it sitting at the dump, all cardboard and sad." -- T.Farnon