[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Floating point lua
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 24 Nov 2000 10:07:42 -0200
> 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.)