[Haskell-cafe] Are there performant mutable Arrays in Haskell?

Brettschneider, Matthias Brettschneider at hs-albsig.de
Wed Mar 25 04:13:45 EDT 2009


> > To make a long story short, here is the library code:
> > elems arr = case bounds arr of
> >       (_l, _u) -> [unsafeAt arr i | i <- [0 .. numElements arr - 1]
> >
> > And my version:
> > boundedElems arr = case bounds arr of
> >       (_l, _u) -> [unsafeAt arr i | i <- [1737 .. 1752]]
> >
> > Is there a reason, why the library version is 4 times faster, than
> mine?
> 
> There shouldn't be any reason.  Try putting
> 
> {-# INLINE boundedElems #-}
> 
> to make it inline, it might be faster.


Ah, ok, did that, but no difference. :) 
If I got it right, for the library version exists a C-translation while
for my version there isn't. 


More information about the Haskell-Cafe mailing list