[Haskell-cafe] [GHC 7.8.4] IO Monad leak space?

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Thu Jul 9 08:12:53 UTC 2015

On Sat, Jul 04, 2015 at 06:17:06AM +0000, Baojun Wang wrote:
> Appreciate for the prompt reply, sorry for that I assumed the allocations
> was caused by space leak. I guess profiling with -auto-all really has huge
> impact on allocations. without profiling, haskell version runs about 50%
> slower than equivalent C version (both with -O2). Maybe that's  as much as
> one could expect.

50% sounds like a good start, but I bet with some time and effort you can
substantially improve on it.  Specifically, the code is spending
*loads* of time doing bounds checking.  It checks on every array read and

I suggest (for an experiment, not production code!) you replace the reads
and writes with unsafe versions and see what speedup that gives you.  I
don't know how to do unsafe reads and writes with the array library, but for
vectors the API is here:



More information about the Haskell-Cafe mailing list