[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua5 / poor performance
- From: RLake@...
- Date: Fri, 21 Mar 2003 10:19:21 -0500
> One problem with this solution is that it demands linking with the
> mathematical library. Currently the core does not need this library
> to work.
Fair enough. The sample code I put here yesterday attempts to avoid
linking with the math library if lua_Numbers are integers, but perhaps
that is not quite good enough.
The use I made of modf is only necessary to preserve the hashing of
small integers to themselves. I suspect this requirement could be
loosened; adding the old exponent to the normalised number should
be adequate... I'll try to test this hypothesis.
ldexp can trivially be replaced with repeated multiplications or
by keeping a table of powers of 2, or some combination of the
frexp is a bit more problematic, but not impossible. One reasonably
rapid solution would be a binary search in a table of powers of 2;
I have a hunch the table could be virtual but I don't have code
handy at the moment. This would only be necessary with very large
and very small numbers, so it might not be too painful.