-- Hypothesis: creating a closure inside a hot loop allocates a heap
-- LuaFunction object plus upvalue slots each iteration. Should produce
-- visibly more GC pressure than equivalent inline code.
function_bench()localtotal=0fori=1,500dolocalx=ilocalf=function(y)returnx+yendtotal=total+f(1)endreturntotalendfori=1,1000do_bench()endprint("alloc/closure: true")