lua-users home
lua-l archive

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


On 20.05.2011 10:20, Dirk Laurie wrote:
>>
>> I don't understand the rational of the removal of math.log10 and the addition
>> of optional second parameter in math.log
> Maybe because there is no longer any strong reason why base 10 is
> any more special than base 2 or whatever.

I would say the API becomes cleaner.

>> It's a general implementation of log, but all opportunities of optimization
>> are lost.
> 
> If you have an application that calculates logarithms base 10 so often
> that the unoptimized implementation slows it down unacceptably — then 
> you write a very short module in C that supplies log10 directly.

...and then you (may) slow it down even further ;) Calling C module from
lua is quite expensive for such simple operations, so you really would
need to check if this way to go.

If the code remains pure-lua only, there will be greater chance for
luajit to optimize it.

Regards,
miko