Petr P | 14 Jan 11:59 2013
Picon

How to properly optimize MArray functions for speed?

  Dear Haskellers,

I'm working on a sorting library for MArrays. Speed is important, so I want to optimize it as much as possible.

Currently, I simply INLINE the sorting function. This speeds up the code more than 10 times. However this can easily explode code size if the function is used in several places.

The only other alternative seems to SPECIALIZE the function for all instances of MArray. This also enlarges the resulting code, but only by a constant factor, not depending on how many times the function is used. The question is, is it possible that new instanes of MArray appear? Or is MArray so special and bound to GHC's internals so that I can be sure that no new instances can be defined by some other module?

  Thanks for help,
  Petr Pudlak
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane