-
Notifications
You must be signed in to change notification settings - Fork 103
Description
I just came across this blogpost comparing different versions of nub: https://oleg.fi/gists/posts/2021-01-07-discrimination-benchmarks.html
(Correspondig benchmarks: https://github.com/ekmett/discrimination/pull/33/files)
Hoogle finds several implementations of hashNub in several packages: https://hoogle.haskell.org/?hoogle=hashNub
So maybe u-c should export the "definitive" version of that function, similar to how containers exports nubOrd[On]?!
(Bikeshed: Would nubHash[On] be better than hashNub[On]?!)
I think we can use unsafeInsert instead of insert (or at least insertNewKey), so this version should be even faster.
In witherable, there's a more general version of hashNub and also a hashNubOn based on alterF. Maybe we can help improve these versions too.
(All this makes me curious how a hashNub based on vector-hashtables would fare.)
CC: @phadej, @klapaucius