lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo wrote:
Just FYI, converting from float to int is more expensive on an x86 machine
than many people realize, if you're using casts to convert.

Since 5.0, Lua can be configured to use a fast conversion method.
Lua 5.1 even tries to do this automatically.

That's neat, I hadn't noticed.

On a similar note, poking around in luaconf.h I tried turning
lua_number2str()'s sprintf() into a gcvt() to see if that
gained anything.  But it was actually slightly slower than
sprintf() (which was a bit surprising because intuitively sprintf
has to do more work, but sprintf has probably been subject to more

Adam D. Moss   -