a faster, accumulating mapM (was Re: [Haskell-cafe] mapM vs mapM_ performance)

Niklas Broberg niklas.broberg at gmail.com
Fri Apr 25 17:47:47 EDT 2008


> > Wow. A 10x slowdown for a very commonly used function that in 99.8% of
>  >  all use cases has no need for the extra laziness at all. No wonder
>  >  some people say Haskell is a toy language...
>
> A toy language that is still much faster than many currently popular
>  languages so... Is Ruby/Python/... a toy too ?

I didn't say I agree, I most certainly don't. What I meant with my
comment was that a slowdown of 10x, just to preserve laziness, is
perfect fuel for those who claim that laziness is good in theory but
bad in practice. And my alarm was more directed towards the fact that
others seemed to find that perfectly acceptable. There are of course
mitigating factors, in particular that mapM is rather uncommon over
input lists that size, and for smaller list (say 50k instead of 500k)
the slowdown isn't even half as bad (more like 2-3x). But I'm glad to
hear that Simon is alarmed too. ;-)

Cheers,

/Niklas


More information about the Haskell-Cafe mailing list