[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and numbers
- From: askok@...
- Date: Thu, 06 Apr 2006 10:46:37 +0300 (EEST)
Just use the "integer patch" from Wiki power patch pages.
http://lua-users.org/wiki/LuaPowerPatches
It boost Lua non-FPU performance by 33-500% (depending on application) and does not modify the
usage of Lua in any way (that is, numbers are numbers, and only internally optimized if they are not
needing FPU's).
The patch is well tested, on both NSLU2 and N770 hardware (ARM CPUs).
-asko
Lainaus Gavin Wraith <gavin@wra1th.plus.com>:
> I know that the question of numbers in Lua have been discussed
> frequently in the Lua-list in the past, but I do not think this
> specific question has been addressed.
>
> As I understand it, Lua is set up to have one basic sort
> of number, LUA_NUMBER, by default 'double', which is used
> internally and to which other sorts of number are cast
> automatically.
>
> What I want is a somewhat different arrangement, because the
> CPU I use (XScale) is not equipped with FP ops or FP
> coprocessor. For that reason, I set LUA_NUMBER to int
> (32 bit in my set up). However I would also like to be able
> to use fp numbers (32 bit again) as a separate sort of
> number (identified by presence of a decimal point in
> numeric literals). I want a single, explicit, int2fp cast
> function, and no implicit casting.
>
> I can certainly see my way to modifying the sources to get this,
> but before I launch myself into activity I thought that I had better
> ask advice. Lots of people may have done this already. What is the best
> way of getting what I want with the least discourteous hackery to the
> sources as they stand?
>
> PS. I know that implicit type conversions are very useful in awk,
> and that it has become traditional to use them in scripting
> languages. However, making explicit all type conversions from int to fp
> (or double, or ... ) is also a useful regime in some circumstances,
> so it would be nice to be able to make such a choice in luaconf.h.
>
> --
> Gavin Wraith (gavin@wra1th.plus.com)
> Home page: http://www.wra1th.plus.com/
>