Futures-rs: Shall quadratic complexity of `join_all` be documented?

Created on 26 Aug 2020  路  5Comments  路  Source: rust-lang/futures-rs

Most helpful comment

Another option would be to have it use FuturesUnordered internally when the number of futures is large.

All 5 comments

Maybe even a

#[cfg(debug_assertions)]
if futures.len() > 1000 {
  warn!("join_all is only intended for running small dynamic lists of futures, use FuturesUnordered for large numbers");
}

(probably could even be a much lower limit, I don't know if anyone has ever tested what a good limit is).

Does futures really use log?

Not currently, but the only other option I can think of would be debug_assert! which seems far too drastic to me.

(I think the fundamental solution is to change the name to include a word that describes its feature(=only efficient for relatively small lists), but that's a breaking change of course.)

Another option would be to have it use FuturesUnordered internally when the number of futures is large.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Matthias247 picture Matthias247  路  4Comments

Nemo157 picture Nemo157  路  5Comments

mqudsi picture mqudsi  路  5Comments

aturon picture aturon  路  5Comments

xrl picture xrl  路  3Comments