[Haskell-cafe] How to properly optimize MArray functions for speed?

Petr P petr.mvd at gmail.com
Mon Jan 14 11:59:40 CET 2013


  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130114/6966e9a9/attachment.htm>


More information about the Haskell-Cafe mailing list