lua-users home
lua-l archive

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


> Because of this, I'd be especially interested to hear if using floats for
> Lua's numbers does actually help.

In my experience it can make a difference (up to 20-30%), not because of
actual computations, but because of size. The main type in Lua is a union
of all basic types (plus a tag); in an "usual" machine, the presence of
a double in this union doubles the size of this type. Therefore, it
hurts (internal) assignments and memory use (allocation, paging, etc.).

(But a double as a basic type is much more comfortable for the programmer,
a main goal of any scripting language.)

-- Roberto