-
Notifications
You must be signed in to change notification settings - Fork 67
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
Uncurryfication seems to be slow #104
Comments
I'm surprised GHC doesn't turn What about By the way, here is how uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p) |
Perhaps, the problem is that the call to This may be a relevant SO thread: |
@nobrakal I just realised that your new implementation is not equivalent to the original one: the strictness properties are different: > g = edges [undefined]
> isEmpty g
False
> g = newEdges [undefined]
> isEmpty g
*** Exception: Prelude.undefined The reason is that you pattern match on the tuple constructor I wonder if it is possible to both keep the full laziness and increase the performance. |
@snowleopard Ah I didn't thought about strictness. Looking a the code produced by GHC, with the current lazy implementation:
Using
So yes, all of this is a strictness issue ! |
@nobrakal I think I'd prefer to keep My understanding is that |
I guess we can close thig now, since it doesn't seem possible to make uncurrying faster while staying lazy. |
As discovered working on #103
Using:
(so uncurryfying "by-hand"),
lead to better performances:
The text was updated successfully, but these errors were encountered: