lua-users home
lua-l archive

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

> > The main reason for using float instead of double is to reduce memory use,
> > Someone in the list mentioned that doubles in some machine were very slow.
> > I'd like to hear more about this.
> For heavy maths (in this case 3D on x86), using exclusively floats for
> floating point maths can provide better performance.  (yeah, I know - a
> marginal difference but why not try)

In an interpreted language such as Lua, this is unlikely to make any
difference on a machine with hardware floating-point support: any speed gain
by using floats will probably be lost in the fetch-decode-execute cycle of
interpretation (which takes a high proportion of total execution time).

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

-- | computation, n.  automated pedantry