Skip to content

avoid waker clones #3748

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

avoid waker clones #3748

wants to merge 2 commits into from

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Jan 8, 2023

We have an internal application that uses s2n from different tasks (one for transmitting, one for receiving), and before this CR, this caused s2n to always clone the wakers and suffer from bad performance.

This change notices that the transmitted context can always be passed down the stack, and improves performance in our case by about ~5%.

If this is too ugly, maybe it is better to do it purely on our end by implementing a replacement to tokio-s2n-tls, but I'll rather use the common implementation and share the goodness.

This is unfortunately a breaking change to anyone that uses the previous waker API.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dougch
Copy link
Contributor

dougch commented Jan 18, 2023

Thanks for the PR, we'll have a look

@camshaft
Copy link
Contributor

Spoke offline; we're going to look into requiring passing &mut core::task::Context to negotiate/receive/send. This will make it so we don't have to clone the waker at all.

@arielb1
Copy link
Contributor Author

arielb1 commented Feb 21, 2023

updated

@dougch
Copy link
Contributor

dougch commented Mar 1, 2023

bindings changed- needs merge conflicts addressed.

@arielb1 arielb1 force-pushed the avoid-waker-clones branch from 13b6982 to 3317003 Compare March 11, 2023 17:40
arielb1 added 2 commits March 11, 2023 20:03
We have an internal application that uses s2n from different tasks (one for
transmitting, one for receiving), and before this CR, this caused
s2n to always clone the wakers and suffer from bad performance.

This change notices that the transmitted context can always be passed
down the stack, and improves performance in our case by about ~5%.
@github-actions
Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants