Missed opportunity for let-no-esape
readArray/writeArray call GHC.Arr.index, which seems inexplicably slow for 2d arrays. inexplicably, because simply copying the default implementation of index from GHC.Arr into the local module can speed things up considerably.
originally raised in this thread: http://www.haskell.org/pipermail/haskell-cafe/2007-March/023394.html
shortened example or matrix/vector-multiplication attached. comment out the first line of myindex to use the local copy. this results in a speedup from 20s to 13s (time ./Index 100000) on my system, not to mention the difference in space usage (a factor of 1000 in allocation, according to +RTS -sstderr..).