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

Simon Peyton-Jones simonpj at microsoft.com
Fri Apr 25 04:42:28 EDT 2008


| 1) Why is the Prelude mapM so slow?  It seems like running 10x slower
| than mapM_ when generating only 50,000 return values is a problem.

All this does seem odd.  I've submitted a ticket so we don't forget it

http://hackage.haskell.org/trac/ghc/ticket/2236

It appears to be some bad (possibly even non-linear) run-time system or garbage collector effect, caused by the very deep stack.

Thanks for persisting with this.  I'd expect mapM to be a bit slower, but not *that* much.

Simon


More information about the Haskell-Cafe mailing list