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

perf(providers): replace wake_by_ref with loop #1428

Merged

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Jun 29, 2022

Motivation

instead of waking up the task when we do a state transition, we poll the next state directly.

Solution

Replace cx.waker().wake_by_ref(); with a loop. This way, the next state is polled immediately and we don't have to rely on the task being polled again right away.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought that removing the loops was the right way to do it, and defer to the runtime to drive each loop step?

@gakonst gakonst merged commit 73d3d3f into gakonst:master Jun 29, 2022
@mattsse
Copy link
Collaborator Author

mattsse commented Jun 29, 2022

that's is just additional overhead, because then you delegate state transitions to the executor, which has to wake up the task and call poll again (but now in the next state), when the next state is already ready to be polled (for the first time).

loop does the same thing but immediately
A ready -> B
continue
poll B

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

Successfully merging this pull request may close these issues.

None yet

2 participants