[Haskell-cafe] Re: [Haskell] [Fwd: Re: Computer Language Shootout]

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Feb 27 16:14:30 EST 2007


On Tue, 2007-02-27 at 16:51 +0000, Claus Reinke wrote:

> okay, profiling was not available for the Haskell version back then, but using ML 
> profiling to improve a Haskell version sounds highly dangerous to me, even more 
> so if the authors do not even mention any awareness of this danger. in 3.5.1, we 
> see Alleles as a BoolVector, which sounds fine until we see it converted to its 
> list of associations, which is then foldl-ed (!) over with a non-strict function (good 
> that those chromosome lengths appear to be only 60..), for every evaluation. this 
> is the main evaluation function for fitness, so it should be very much inner loop, 
> with population sizes and generations ranging to 7500/700 and 50/150000.
>  .
> of course, the same function in the ML version just means running a loop over a
> vector, with a strict accumulator..

It'd be interesting to get the real code for this. Partly to just try
optimising it but more so as a real test case for list/array fusion.

As far as I see, there's no reason that consuming an assoc list of a
bool vector with a foldl' (the ' is probably essential) should be slow.
If it's fused properly no list cells should ever be allocated, we should
get the loop over the vector.

Duncan



More information about the Haskell-Cafe mailing list