[Haskell-cafe] forLoop + strict State monad is much faster than foldl'

Niklas Hambüchen mail at nh2.me
Wed Apr 30 02:04:41 UTC 2014


On 30/04/14 02:16, John Lato wrote:
> So this is interesting.  The forLoop code gets compiled into a nice loop
> in core over unboxed Ints.  The foldl' function OTOH still goes via a
> list.  I expect it's not foldl' itself that's slow, rather that it
> doesn't fuse with the list producers in current GHCs.  This may be
> improved in the future.  Especially as the vectorized foldl' does fuse.

It bothers me especially as the comments around `enumFromTo` seem to
explicitly talk about deforestation.


More information about the Haskell-Cafe mailing list