lua-users home
lua-l archive

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


Let's say I'm writing a program that's intended for use on LuaJIT.

Is it still necessary to cache globals in local variables for decent
performance, or can I expect the JIT to optimise this for me?

For example:

i = 0
while (i < 10000) do i = i + 1 end

vs.

local i = 0
while (i < 10000) do i = i + 1 end

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

Attachment: signature.asc
Description: OpenPGP digital signature