You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ljx/bench/cloperf.lua

24 lines
289 B
Lua

-- benchmark closure/upvalue performance
local upv=4
local dummy
local function cc(n)
local res
do
dummy = function() return dummy end
local za=upv+4
res=za+1
end
return res+upv+1+n
end
local function x()
return cc
end
res=0
for i=1,1e8 do
local r = x()
res=res+r(i)
end