[Haskell-cafe] Why is vector sort slower than list sort?

Toby Goodwin toby at paccrat.org
Sat May 30 11:46:00 UTC 2015


>I'm led to believe that sorting mutable vectors is faster than sorting
>lists.

For one thing, you should use "-O2" when looking at performance.

For another, you're not actually looking at the sort in isolation. If
you pull it out to the top-level (e.g. "doSort = L.sort") so you can
see it in the profiling, then even without -O2 I see the vector sort is
faster. (Arguably you should include the cost of freezing the vector
too.)

Regards,

Toby.


More information about the Haskell-Cafe mailing list