-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is unions
"little" wrong ?
#139
Comments
Thanks for the report, @ashishnegi. Indeed it does seem like we're missing out on some easy wins!
This is the relevant code section: unordered-containers/Data/HashSet/Base.hs Lines 267 to 278 in f1a53e2
Since unordered-containers/Data/HashMap/Base.hs Lines 1368 to 1384 in f1a53e2
I think we should first check whether this advice is still true. @tibbe, do you have any insight here? |
I don't remember the details here but likely |
Thanks, @tibbe! :) It would be good to investigate the issue a bit! :) I think the first thing to do would be some simple benchmarks in order to confirm that this "performance bias" exists. It would also be interesting to know where the bias comes from – somewhere in @ashishnegi Are you still interested in this issue? |
it has been some time since i used this repo.. and haskell :( |
Thanks for the fast response, @ashishnegi! :) I understand that you're currently not interested in working on this. No wonder – it's been 3 and a half years! |
If we flip the |
If this performance bias actually exists, improving -unions = L.foldl' union empty
+unions = L.foldl' (flip (unionWith (flip const))) empty (just check that the In fact, if this implementation gives significantly better benchmark results, I'd take that as sufficient evidence that the claimed performance bias exists. |
Good point! |
Looking at unions and
union
union
says that first argument should be smaller set.foldl'
used inunions
would give bigger sets in each iteration's accumulator,which becomes first argument to
union
; leading to slower performance.Should not we use
flip union
inunions
?Or i am missing something.
The text was updated successfully, but these errors were encountered: