12-26-2015, 11:38 PM
(This post was last modified: 12-26-2015, 11:38 PM by LogicParrot.)
Interestingly, this variation also took ~60 seconds even though it doesn't use tables inside the loop.
local MyClass = {}
function MyClass:new()
local Obj = {}
setmetatable(Obj, self)
self.__index = self
Obj.TestVar = math.random(50)
return Obj
end
function Test(val)
return val + 50
end
local startTime = os.clock()
local Constr = MyClass:new()
local test = Test
R = Constr.TestVar
for I = 1, 1000000000 do
R = test(R )
end
Constr.TestVar = R
print(os.clock() - startTime);

