[Mono-list] Re: Time problems on Mono

Jonathan Gilbert 2a5gjx302@sneakemail.com
Tue, 14 Dec 2004 17:11:10 -0500


At 07:40 PM 14/12/2004 +0100, Paolo Molaro wrote:
[snip]
>Yep, we should remove mul by 1.0 (and also change mul by 2.0 with an 
>addition, for example).

Actually, isn't multiplication by 2.0 faster than an addition for
floating-point? Certainly, with integer math, an addition would be
substantially faster, but as soon as floating-point is involved, an
addition has to scale the smaller number so that its mantissa matches that
of larger number, and even when no scaling is actually necessary, it will
likely hit performance.

Obviously a test is necessary, but intuitively, it feels to me like it'd be
faster to leave it as a multiplication in this case. :-)

Jonathan Gilbert