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

WIP: Backend based on poll-functions rather than boxed futures #85

Closed
wants to merge 10 commits into from

Conversation

plaidfinch
Copy link
Contributor

@plaidfinch plaidfinch commented Mar 27, 2021

This resolves #78 and along the way resolves #76.

  • In order for this to work, a new point release of call-by needs to happen.

The individual backends have not yet been updated.
This enables us to bound every Chan as having a Transmitter and Receiver, because now Unavailable
can implement those traits. And that in turn allows us to have a unified error type which
encompasses sending and receiving errors on channels. And that in turn allows us to implement
auto-flushing, only when it is needed by the protocol. All this, is implemented in this commit.
This adds a ReceiveChoice and TransmitChoice bound, and removes the now-unnecessary Send + 'static bounds.
@plaidfinch plaidfinch added enhancement New feature or request performance labels Mar 27, 2021
@plaidfinch plaidfinch added this to the 0.4 milestone Mar 27, 2021
@plaidfinch plaidfinch self-assigned this Mar 27, 2021
@plaidfinch plaidfinch marked this pull request as draft March 27, 2021 00:14
@plaidfinch
Copy link
Contributor Author

After benchmarking this mostly completed PR, it decreases performance by about 10% across the board, and specifically by almost 100% for mpsc::Sender, due to the necessary use of PollSender to fit the new API. A conversation with @hawkw (thanks!) revealed that PollSender does more allocation in the hot path in this backend than the use of Pin<Box<dyn Future>> does in the previous version. Additionally, some optimizations are only safe in an async/await context, and we may be missing those by using manual futures. Recommend keeping this branch around for potential future reference if we need to make a performance refactor in the future, but releasing 0.4 without this refactor.

@plaidfinch plaidfinch closed this Mar 30, 2021
@plaidfinch plaidfinch reopened this Mar 30, 2021
@plaidfinch plaidfinch closed this Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support batching backends Transition to poll_fn style backend traits
1 participant