Skip to content

Conversation

@robert3005
Copy link
Contributor

@robert3005 robert3005 commented Jan 20, 2025

No description provided.

@robert3005 robert3005 enabled auto-merge (squash) January 20, 2025 18:20
@robert3005 robert3005 merged commit 452b02b into develop Jan 20, 2025
20 checks passed
@robert3005 robert3005 deleted the rk/joinall branch January 20, 2025 18:41

// Populate the cache
try_join_all(cache_futures).await?;
FuturesUnordered::from_iter(cache_futures)
Copy link
Contributor

Choose a reason for hiding this comment

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

try_join_all polls all the futures, and we don't care about using the results. I don't understand what difference this makes? Am I misunderstanding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FuturesUnordered also polls all the futures but better. In all seriousness this is a minor change where try_join_all defaults to FuturesOrdered if there’s more than 30 futures and in this case futuresunordered would be marginally faster

Copy link
Contributor

Choose a reason for hiding this comment

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

But why would it be faster? What's the actual difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went from the futures docs where they suggest directly constructing futuresordered/unordered if the number of them https://docs.rs/futures/latest/futures/future/fn.try_join_all.html#see-also. Afaik polling mechanism is different

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.

4 participants