lspitzner / pqueue

Haskell priority queue package
Other
15 stars 13 forks source link

Switch testing from sortOn to sortWith #113

Open treeowl opened 1 year ago

treeowl commented 1 year ago

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.

konsumlamm commented 1 year ago

The tests already run pretty fast (~0.2s) and using sortWith makes no difference for me.

treeowl commented 1 year ago

I'd like to do it anyway. Do you mind for some reason?

konsumlamm commented 1 year ago

No, feel free to make a PR.