readArray is faster than unsafeRead

Ian Lynagh igloo at
Sun Jul 1 08:47:32 EDT 2007

On Tue, May 29, 2007 at 02:42:22PM -0700, Scott Dillard wrote:
> You're right. I broke them when experimenting to see where the cycles
> were going. I've fixed them, but the other pair of functions, named
> gaussElim2, were correct and the issue remains that unsafeRead appears
> slower than readArray.

Separating the functions into different executables and compiling with
GHC 6.6 without profiling, the unsafe one is definitely faster:

./safe  45.73s user 0.06s system 96% cpu 47.238 total
./unsafe  6.65s user 0.02s system 91% cpu 7.295 total


More information about the Glasgow-haskell-users mailing list