lua-users home
lua-l archive

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

Mark Hamburg wrote:
> Some statistics. This basically is the result of timing a loop
> that counts up to a really big number using various ways of
> storing the counter.

The following existing benchmark does similar things, except it
factors in the cost of calls:

> LuaJIT levels the playing field.

It's able to optimize away the differences and ends up with almost
the same machine code in all cases.

Same thing happens with the above mentioned benchmark (lower
numbers are better):

Lua 5.1  LJ1    LJ2
14.08    2.16   0.10  Standard (solid)
14.92    4.62   0.10  Standard (metatable)
14.28    2.66   0.10  Object using closures (PiL 16.4)
 9.14    1.68   0.10  Object using closures (noself)
 7.30    1.10   0.10  Direct Access
 1.22    0.34   0.10  Local Variable

[Yes, this really means method access + method calls can be up to
150x faster with LJ2, when compared in isolation. On real-world,
non-micro-benchmarks you won't see that much of a speedup.]