Fwd: [Haskell-beginners] Optimization Problem

Daniel Fischer daniel.is.fischer at web.de
Mon Aug 9 22:35:31 EDT 2010

On Tuesday 10 August 2010 04:02:32, Daniel Fischer wrote:
> It could, but it doesn't (at least not in core). Most of the time it
> doesn't make a significant difference whether you use (x ^ 2) or (x *
> x), but sometimes it can make a big difference (we had an example
> earlier this year, but I can't seem to find it now).

Finally found it:
shows an example where the use of (x ^ 2) instead of (x * x) prevented 
sharing of a common subexpression, thus creating an O(2^n) algorithm from 
what rightfully was an O(n) algorithm.

More information about the Beginners mailing list