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

Improve the implementation of JoinAll? #2141

Closed
najamelan opened this issue Apr 29, 2020 · 2 comments
Closed

Improve the implementation of JoinAll? #2141

najamelan opened this issue Apr 29, 2020 · 2 comments

Comments

@najamelan
Copy link
Contributor

Recently some thought has gone into futures that eternally return Ready and thus never yield to the executor (#2047, #2053, #2130). Particularly concerned are combinators and collections. FuturesUnordered has already been updated to yield every so often.

JoinHandle is another collection that might never yield. Should we implement it with FuturesUnordered under the hood or should we add some counter to the implementation?

@Nemo157
Copy link
Member

Nemo157 commented Apr 29, 2020

Using FuturesUnordered under the hood would make JoinAll itself pretty pointless, the only advantage it has over using FuturesUnordered is potentially lower overhead when used for a low number of futures (though I don't know if this has ever been benchmarked).

Unlike FuturesUnordered and Shared, JoinAll doesn't intercept the Waker, so it will not encounter the same issue of never yielding. It will poll each sub-future at most once per poll.

@najamelan
Copy link
Contributor Author

Looking at the code again, you are right. So I'll close this.

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

No branches or pull requests

2 participants