Massive slowdown in mwc-random after switching to use of primitive package

Bryan O'Sullivan bos at
Sun Jul 11 08:49:30 EDT 2010

On Sun, Jul 11, 2010 at 12:59 AM, Dan Doel <dan.doel at> wrote:

> You're using GHC 6.12.x presumably?

That's right.

> There are known performance problems with
> using abstract PrimMonads in that version (and, actually, just using IO as
> well).

Ah, that's a shame. I'm surprised it would be affecting IO too!

> In the IO case for instance, checking the core tends to reveal lots of
> casting

between RealWorld and PrimState IO, despite the fact that those should be
> identical.

I'd certainly noticed that the Core for the PrimMonad code was huge and
almost impossible to follow for the enormous amount of casting that was
taking place.

The good news is that, last I checked, this isn't a problem in HEAD. The
> optimizer does better there somehow. The bad news is that 6.14 isn't out
> yet,
> so you probably have to wait for a real fix.

I might revert both mwc-random and statistics back to using plain ST for
now, then, as having them run slightly faster than 1% of their former speed
is a bit painful :-(
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list