-
Notifications
You must be signed in to change notification settings - Fork 535
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
Improve performance of Parallel by overriding map2 to avoid tupling #2155
Comments
I'll give it a try 😄 |
@djspiewak Why is the |
Maybe I'm just being dense, but then, if Are we sure that we can't just reimplement |
An error on my part. :-) It really should be |
This is a bit of low-hanging fruit, but we currently define
Parallel[F]
givenGenSpawn[F, _]
in terms of the following construction:That's cool but there's a lot of unnecessary boxing in here, both in
both
and inracePair
underneath. We can actually do a lot better givenGenConcurrent[F, _]
, which will be the case quite a lot of the time in practical code. However, rather than creating some sort of sneaky implicit prioritization thing, I think the right approach here is probably to add amapBoth
function (feel free to bikeshed the name) toGenSpawn
, then override it inGenConcurrent
with a more efficient implementation in terms ofFiber
andDeferred
.Overall this probably sounds a lot more intimidating of an enhancement than it actually is. Tldr, add the following to
GenSpawn
:Delegate the implementation to
both
inGenSpawn
, but then override that implementation inGenConcurrent
with something implemented in terms ofFiber
andDeferred
. The results should be a noticeable improvement in performance of thepar
operators.The text was updated successfully, but these errors were encountered: