lua-users home
lua-l archive

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


On 15/05/2009 14:14, Olivier Hamel wrote:
code, there's some un-optimized stuff IMO (unless I'm wrong):

if __v10 then
   local __v12x = __v13x
   local __v14x = __v12x * __v12x
   __v10 = __v14x * __v14x + 1
end


Becomes:

if __v10 then

   __v10 = __v13x^4 + 1

end

It would need a bit more of magic! The tool was just unrolling the function calls, thus the operations. Transforming a series of mathematical operations to an equivalent unique mathematical operation is a more advanced concept.

Beside, depending on platform, using an integer power operator might result in slower operation than several multiplications. Unless I am mistaken? Is it false on boards with floating-point operations?

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --