lua-users home
lua-l archive

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


On Dec 13, 2001 at 06:22 +0000, Martin Hollis wrote:
>
> bandwidth, memory usage. Am I right in thinking that because of the cell 
> size, these considerations are actually irrelevant in lua?

No, in Lua 4.0 on i386, a Lua stack cell is 16 bytes, because it
consists of an integer type (4 bytes), plus a union of several other
things.  The other things are all pointers (4 bytes), except for the
number which is a double (8 bytes) by default.  If you use int or
float for Lua's number type, then a stack cell fits snugly in 8 bytes
(4 bytes for the type, and 4 bytes for the union).

I don't know much about where else in Lua these cells are used, or the
overall impact on memory use.

In general I agree with using 'double' as the default number type --
it is practically always safe, which is what you usually want in a
scripting language.

-- 
Thatcher Ulrich <tu@tulrich.com>
http://tulrich.com