<div dir="ltr">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 current nub.<div>
<br></div><div>Has anyone looked at Bart's patches to see how difficult it would be to apply them (or re-write them)?<br><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 8:43 PM, Clark Gaebel <span dir="ltr"><<a href="mailto:cgaebel@uwaterloo.ca" target="_blank">cgaebel@uwaterloo.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Apologies. I was being lazy. Here's a stable version:<br>
<div class="im"><br>
import qualified Data.HashSet as S<br>
<br>
</div> hashNub :: (Ord a) => [a] -> [a]<br>
hashNub l = go S.empty l<br>
where<br>
go _ [] = []<br>
go s (x:xs) = if x `S.member` s then go s xs<br>
else x : go (S.insert x s) xs<br>
<br>
Which, again, will probably be faster than the one using Ord, and I<br>
can't think of any cases where I'd want the one using Ord instead. I<br>
may just not be creative enough, though.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
- Clark<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Jul 15, 2013 at 12:46 AM, Brandon Allbery <<a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>> wrote:<br>
> On Sun, Jul 14, 2013 at 7:54 AM, Clark Gaebel <<a href="mailto:cgaebel@uwaterloo.ca">cgaebel@uwaterloo.ca</a>> wrote:<br>
>><br>
>> Oops sorry I guess my point wasn't clear.<br>
>><br>
>> Why ord based when hashable is faster? Then there's no reason this has to<br>
>> be in base, it can just be a<br>
><br>
> Did the point about "stable" fly overhead?<br>
><br>
> --<br>
> brandon s allbery kf8nh sine nomine associates<br>
> <a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a> <a href="mailto:ballbery@sinenomine.net">ballbery@sinenomine.net</a><br>
> unix, openafs, kerberos, infrastructure, xmonad <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a><br>
<br>
</div></div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div></div></div>