lua-users home
lua-l archive

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

I updated the tests to compute a sum with a global value involved (should prevent empty loop optimization). Here are the new results, closer to what Mike said about metatable based implementations beeing faster (the tests also run 10x more loops then the previous test).

implementation Lua memory LuaJit memory Lua speed LuaJit speed
closures (no self) 95.6 Mb 62.6 Mb 11’821 ms 355 ms
metatable 40.4 Mb 29.8 Mb 17’004 ms 323 ms



On Sat, Nov 27, 2010 at 12:57 PM, Mike Pall <> wrote:
Gaspard Bucher wrote:
> From your comments, I understand that I should use the metatable approach
> since LuaJit can do more optimizations on them and memory usage is lower, is
> this correct ?