LuaJIT
#14
I just tested that. It was ~50 seconds while your original code was 60Tongue
Let me try to come up with some hacky way to make the other variable local too, it'd be interesting to compare. Though it would certainly not be tidied code.

This one took 9 seconds:

local MyClass = {}

function MyClass:new()
    local Obj = {}
    setmetatable(Obj, self)
    self.__index = self

    Obj.TestVar = math.random(50)

    return Obj
end

local startTime = os.clock()
local Constr = MyClass:new()
local R = Constr.TestVar
for I = 1, 1000000000 do
    R = R + 50
end
Constr.TestVar = R
print(os.clock() - startTime);

You have a point.
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: 5 Guest(s)