[Haskell] Re: ST/STRef vs. IO/IORef

Remi Turk rturk at science.uva.nl
Fri Aug 5 05:52:19 EDT 2005

On Fri, Aug 05, 2005 at 01:13:06PM +0400, Bulat Ziganshin wrote:
> Hello Till,
> Friday, August 05, 2005, 10:04:53 AM, you wrote:
> TM>                MonadState  IOArray IOArray          ST
> TM>                with                with             with
> TM>                FiniteMap           unsafePerformIO  MutArr
> TM> safe           yes        yes         no            yes
> TM> efficient      no         yes         yes           yes
> afaik, ST efficient only with small enough arrays. one time i tried
> STArray of about 100 000 elements and seen that things goes much worse
> than in IO monad with IOArray. on small arrays STArray performs good
> enough
> (i was trying to create sorting routine. afair, it was an insert sort)

It might have been caused by a recently fixed (in CVS) unfeature/bug,
described on

IIRC, if the same code could be used both for "ST s a" and for
"IO a", GHC could fail to specialize the "ST s a" version because
it had a typevariable too much.


Nobody can be exactly like me. Even I have trouble doing it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20050805/d766903d/attachment-0001.bin

More information about the Haskell mailing list