-
Notifications
You must be signed in to change notification settings - Fork 289
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
[WIP] Async/Await: No futures executor #166
Conversation
6923c71
to
86fe575
Compare
Switch from futures executor (which is only for testing) to either pure implementations or usages of tokio.
a7744b9
to
96009ad
Compare
Hi @dbcfd, thanks for the PR, and apologies for the long response time! #143 has landed in a slightly modified form as #187. I adopted some of the cleanup you made in this PR as well. I'm afraid I'm not sure what to do with this PR, or if it's even still applicable. The Anyway, let me know if there are actual performance problems with the current version of master, and if so, we can discuss using the Tokio runtime instead! |
@benesch There's actually a runtime behind that futures::executor, albeit a very simple one. It will then be contending for other threads that were spawned, rather than interweaved with the actual executor being used. This then produces the refactor of MessageStream, which allows it to implement stream, rather than using a channel sending between a spawned thread running a different executor and whatever is processing the receiver side. You may also miss wakeups on the channel in this case. Since the poll timeout is only 100ms, we could probably not using tokio blocking. |
Now that your PR has landed, I can take another stab at this PR, with a few less changes and without both futures executor and tokio block on. |
I'm not sure what you mean here? It should spawn a single-threaded executor on the poll thread itself; essentially we're just performing a blocking send on the channel using the thread we already have. Replacing that by instead blocking the task doesn't seem obviously better? (Happy to be proven wrong by benchmarks here, though!) I agree that the extra thread is unfortunate, though. One thing that I've wanted to try is calling Thanks for looking into this, by the way! |
And if you do wind up rebasing this, it'll be easier if you can wait a few minutes and rebase on top of #188 too! |
Closing for #192 |
This builds on the work of #143
Futures executor is meant mainly for testing and not production usage. This PR makes things more async friendly, getting rid of additional spawns and blocking. When necessary tokio is used for execution and blocking.