lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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