Skip to content
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

Investigate: replace FastFuture with new future + ExecutionContext.callingThread #2461

Open
helena opened this issue Feb 25, 2019 · 8 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:core Issues related to the akka-http-core module

Comments

@helena
Copy link
Member

helena commented Feb 25, 2019

See if FastFuture could be replaced by the new Future implementation combined with using ExecutionContext.callingThread shown here: https://github.com/scala/scala/pull/7784/files

thanks @viktorklang

@johanandren
Copy link
Member

Note that we will be blocked on supporting Scala 2.11 (less) and 2.12 (more) for quite some time before we can actually migrate if it turns out on par. Good to investigate though.

@viktorklang
Copy link
Member

@johanandren True—would be great to see what the diff looks like.

@patriknw patriknw transferred this issue from akka/akka Mar 12, 2019
@viktorklang
Copy link
Member

viktorklang commented Mar 13, 2019 via email

@jrudolph jrudolph added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:core Issues related to the akka-http-core module labels Jul 30, 2019
@jrudolph
Copy link
Member

The main benefit of FastFuture is to avoid going through a dispatcher at all if the future has already been completed. In the best case if everything inlines perfectly we could get the same performance with the new execution context but that's the upper bound of what's possible. In any case, where inlining doesn't work for any reason or there's a true dynamic dispatch call-site because sometimes a future is already completed and sometimes not it cannot be faster.

Given the low complexity and maintenance overhead of FastFuture, I don't think it's worthwhile changing anything but I'd like to be proven wrong if someone cares :)

@viktorklang
Copy link
Member

viktorklang commented Jul 30, 2019 via email

@jrudolph
Copy link
Member

jrudolph commented Jul 30, 2019

Getting stack safety is nice tho?

I think there's no recursion involved in FastFuture so not sure if there's anything that would be stack unsafe. It doesn't use the sameThreadExecutionContext, it just optimizes for the already completed case.

@viktorklang
Copy link
Member

Ah, I'm thinking more if you mix Future and FastFuture.

@SethTisue
Copy link
Contributor

SethTisue commented Oct 7, 2022

I'm only mildly curious (it came up in a chat room), but perhaps I'm not the only one now wondering where this stands after scala/scala#7470 (Scala 2.13.0) and scala/scala#9270 (Scala 2.13.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:core Issues related to the akka-http-core module
Projects
None yet
Development

No branches or pull requests

5 participants