[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unnecessary New Closures
- From: David Manura <dm.lua@...>
- Date: Fri, 7 Sep 2007 23:51:21 +0000 (UTC)
Aaron Brown <arundelo <at> hotmail.com> writes:
> Do-nothing functions can be used as gensyms (unique values).
> They are a slightly faster to create than empty tables:
>
> $ time lua -e 't={} for i=1,999999 do t[i]={}end'
>
> real 0m5.453s
> user 0m5.249s
> sys 0m0.124s
> $ time lua -e 't={} for i=1,999999 do t[i]=function()end end'
>
> real 0m3.172s
> user 0m2.890s
> sys 0m0.170s
and only slightly-slightly (~10%) faster than newproxy (userdata):
$ time lua -e 't={} local newproxy=newproxy; for i=1,999999 do t[i]=newproxy()
end '