[Haskell-cafe] Mysterious factorial

Daniel Fischer daniel.is.fischer at web.de
Wed Dec 30 11:40:37 EST 2009


Am Mittwoch 30 Dezember 2009 17:28:37 schrieb Roel van Dijk:
> I can't offer much insight but could the answer lie in the Integer
> type? I suspect that with a sufficiently large fixed Int type (2^14
> bits?) the performance of the two functions would be almost equal.

For fact (10^6), we'd need rather 2^24 bits for the performance to be comparable.
Imagine such an ALU :D

>
> Could it be that the second function delays the multiplication of
> large numbers as long as possible? The divide-and-conquer approach?

Exactly.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091230/1d85045f/attachment.html


More information about the Haskell-Cafe mailing list