[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New to-be-closed variable list implementation question
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 12 Mar 2021 11:43:57 -0300
> Just to be clear: as Xavier guessed above, I was implying a linear search
> in the stack (having a total count of to-be-closed vars would help avoid
> searching part of it).
>
> The reason for this question is that I'm the unlucky one for whom the extra
> fields added to stack value structure could matter... so there might be a
> speed/space tradeoff. I'm not suggesting that you implement that, just
> asking if it makes sense to you.
If you are using the NaN-trick representation, I imagine that even that
one bit that you need must be stored inside the value itself (cleverly
assuming that float values cannot be marked to-be-closed). But then you
will have the problem Dibyendu talked about, that any copy of stack
values would need to clear that bit, which in turn demands a test,
because floats don't have that bit. That probably will be somewhat
expensive for any code, even if it does not use tbc variables.
Usually, stacks in Lua comprise a very small fraction of a program's
memory footprint. Even doubling their sizes should have a small
overall impact.
-- Roberto