[Haskell-cafe] A tale of Project Euler
Henning Thielemann
lemming at henning-thielemann.de
Tue Nov 27 15:57:22 EST 2007
On Tue, 27 Nov 2007, Andrew Coppin wrote:
> So, now I have a Haskell version that's "only" several hundred times
> slower. Neither program is especially optimised, yet the C version is
> drastically faster. This makes me sad. :-(
I think the C version is so much faster because it does not need
allocations in the inner loop. If you rewrite your program using a mutable
array your program should become faster - and more ugly. However it might
be fast enough if you create a new array for each run over the array with
a new prime. Then you do not need mutable arrays.
More information about the Haskell-Cafe
mailing list