jwlato at gmail.com
Tue Jul 16 03:46:00 CEST 2013
In my tests, using unordered-containers was slightly slower than using Ord,
although as the number of repeated elements grows unordered-containers
appears to have an advantage. I'm sure the relative costs of comparison vs
hashing would affect this also. But both are dramatically better than the
Has anyone looked at Bart's patches to see how difficult it would be to
apply them (or re-write them)?
On Mon, Jul 15, 2013 at 8:43 PM, Clark Gaebel <cgaebel at uwaterloo.ca> wrote:
> Apologies. I was being lazy. Here's a stable version:
> import qualified Data.HashSet as S
> hashNub :: (Ord a) => [a] -> [a]
> hashNub l = go S.empty l
> go _  = 
> go s (x:xs) = if x `S.member` s then go s xs
> else x : go (S.insert x s) xs
> Which, again, will probably be faster than the one using Ord, and I
> can't think of any cases where I'd want the one using Ord instead. I
> may just not be creative enough, though.
> - Clark
> On Mon, Jul 15, 2013 at 12:46 AM, Brandon Allbery <allbery.b at gmail.com>
> > On Sun, Jul 14, 2013 at 7:54 AM, Clark Gaebel <cgaebel at uwaterloo.ca>
> >> Oops sorry I guess my point wasn't clear.
> >> Why ord based when hashable is faster? Then there's no reason this has
> >> be in base, it can just be a
> > Did the point about "stable" fly overhead?
> > --
> > brandon s allbery kf8nh sine nomine
> > allbery.b at gmail.com
> ballbery at sinenomine.net
> > unix, openafs, kerberos, infrastructure, xmonad
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe