[Haskell-cafe] Performance question

Andrew Coppin andrewcoppin at btinternet.com
Thu Mar 18 17:36:26 EDT 2010


Daniel Fischer wrote:
> If it's called often, and the arrays are 0-based and Int-indexed,
>
> import Data.Array.Base (unsafeAt)
>
> and replacing ! with `unsafeAt` should give a speed-up, though probably not 
> terribly much. If you don't need the polymorphism and your array elements 
> are unboxable, using UArray from Data.Array.Unboxed should be significantly 
> faster.
>   

Beware that unboxed arrays are strict, and changing the strictness 
properties of your code can have non-obvious consequences...



More information about the Haskell-Cafe mailing list