Skip to content

Conversation

Lucretiel
Copy link
Contributor

This PR removes the loop from stream::ForEach. Instead, the future
makes at most 1 attempt to poll its interior, and if it can make more
progress, it immediately calls wake_by_ref(), then returns Pending.
In this way, under a fair executor, it can't accidentally starve the
task queue.

This PR removes the `loop` from `stream::ForEach`. Instead, the future
makes at most 1 attempt to poll its interior, and if it can make more
progress, it immediately calls `wake_by_ref()`, then returns Pending.
In this way, under a fair executor, it can't accidentally starve the
task queue.
@cramertj
Copy link
Member

cramertj commented Oct 6, 2020

I'm skeptical of this approach-- see my the related discussion between myself, @jonhoo , and @carllerche in this thread: #2049 (comment)

I also anticipate that this PR would have significant negative performance implications if we adopted this approach throughout the ecosystem: yielding back up to the top-level executor with every step seems like it would interact poorly with locality, and could be very inefficient depending on the top-level executor's queuing implementation.

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.

3 participants