[Haskell-cafe] GHC vs GCC

Bryan O'Sullivan bos at serpentine.com
Fri Mar 26 17:33:39 EDT 2010

On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida <
almeidaraf at gmail.com> wrote:

> During a talk with a friend I came up with two programs, one written in
> C and another in haskell.

Your Haskell code builds a huge thunked accumulator value, so of course it's
slow (put bang patterns on all arguments). Also, you should use rem instead
of mod. Make those tiny changes and you'll get a 5x speedup, to half the
performance of the C code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100326/672664e6/attachment.html

More information about the Haskell-Cafe mailing list