
27 Nov
2007
27 Nov
'07
3:57 p.m.
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.