LuaJIT
#10
(12-26-2015, 09:56 PM)NiLSPACE Wrote: I found another reason for moving to LuaJit. Accessing tables is much faster making OOP much faster. Accessing a method in a table 1.000.000.000 times took 93.534 seconds in Lua, while it only took 0.425 seconds in LuaJit.

Now, naturally it won't happen allot that a plugin would call a method a billion times, but in the WorldEdit plugin I sometimes had to define a function locally instead of calling it from the table because the performance impact would otherwise be too great.

Try creating a local reference to the method before calling it 1,000,000,000 times. I believe you'd get very similar performace.

e.g.
Code:
local foo = myTable.Function;
for i = 0, 1000000000 do
  foo()
end

In general, Lua is much faster with locals. I don't think this justifies LuaJit. Just make a local before a tight loop.
Reply
Thanks given by:


Messages In This Thread
LuaJIT - by worktycho - 03-24-2014, 03:12 AM
RE: LuaJIT - by worktycho - 03-24-2014, 04:14 AM
RE: LuaJIT - by xoft - 03-24-2014, 05:11 AM
RE: LuaJIT - by worktycho - 03-24-2014, 07:37 AM
RE: LuaJIT - by NiLSPACE - 03-30-2014, 07:28 AM
RE: LuaJIT - by xoft - 03-30-2014, 09:58 AM
RE: LuaJIT - by bearbin - 03-31-2014, 12:31 AM
RE: LuaJIT - by worktycho - 03-31-2014, 02:15 AM
RE: LuaJIT - by NiLSPACE - 12-26-2015, 09:56 PM
RE: LuaJIT - by LogicParrot - 12-26-2015, 11:02 PM
RE: LuaJIT - by NiLSPACE - 12-26-2015, 11:11 PM
RE: LuaJIT - by LogicParrot - 12-26-2015, 11:19 PM
RE: LuaJIT - by NiLSPACE - 12-26-2015, 11:23 PM
RE: LuaJIT - by LogicParrot - 12-26-2015, 11:24 PM
RE: LuaJIT - by LogicParrot - 12-26-2015, 11:38 PM
RE: LuaJIT - by NiLSPACE - 12-26-2015, 11:57 PM
RE: LuaJIT - by NiLSPACE - 12-27-2015, 11:40 PM
RE: LuaJIT - by NiLSPACE - 12-28-2015, 04:05 AM
RE: LuaJIT - by worktycho - 12-28-2015, 08:47 AM
RE: LuaJIT - by LogicParrot - 12-28-2015, 09:23 AM
RE: LuaJIT - by worktycho - 12-28-2015, 09:25 AM



Users browsing this thread: 1 Guest(s)