On Mon, Nov 17, 2008 at 3:38 PM, Peter Cawley <lua@corsix.org> wrote:
It may be worth looking at the generated Lua opcodes for these benchmarks in
order to easier see the differences in what is happening in each. For
example, return true v.s return nil are loadbool,return vs. loadnil,return.
Then looking at the VM code for these operations, either in C or as the
assembled output of the C, might make it clearer. Of course, this won't help
with explaining the luajit results, as it skips the VM when JITing.
Sorry for the late reply.
Opcode listing (via luac -l -l) is indeed very helpful. Chaining calls
use less resources, since they do not require extra MOVE opcodes:
local function chain_local()
local chain = chain
chain () () () () () () () () () () -- 10 calls
end