Data.List.sortOn uses a decorate-sort-undecorate algorithm. That's great when the passed function is expensive. But when it's very cheap, it just wastes time and space. In our tests, we have a bunch of sortOn Down. Since Down is just a coercion, this is lousy. We should instead use GHC.Exts.sortWith, which applies the passed function each time.
Data.List.sortOn
uses a decorate-sort-undecorate algorithm. That's great when the passed function is expensive. But when it's very cheap, it just wastes time and space. In our tests, we have a bunch ofsortOn Down
. SinceDown
is just a coercion, this is lousy. We should instead useGHC.Exts.sortWith
, which applies the passed function each time.