[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (alpha) now available
- From: Coda Highland <chighland@...>
- Date: Fri, 1 Aug 2014 12:13:26 -0700
On Fri, Aug 1, 2014 at 12:08 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> If there is no API function for this, then there is no call for having
> it in Lua.
>
> What would such an API function do? Traverse the whole table and
> set every value to nil, in order to adjust the reference count. It's not
> obvious that the performance enhancement relative to
>
> for k in pairs(tbl) do tbl[k]=nil end
>
> is worth yet another library function in a language that can't even carry
> the baggage of cosh, sinh and tanh.
Is that the only way to achieve it? Is there not a way to simply
disown the contents of the table and leave it for GC? I mean, even if
it's "create new empty table, swap internal data pointers, let new
table go unreferenced" that would be faster than a loop -- and it
would be something that couldn't be achieved by Lua code.
/s/ Adam