Skip to content

Commit 2417c1b

Browse files
Merge pull request #687 from antiguru/exchange_new
Efficient Exchange::new
2 parents a8f383a + e200fda commit 2417c1b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

timely/src/dataflow/channels/pushers/exchange.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ where
2727
{
2828
/// Allocates a new `Exchange` from a supplied set of pushers and a distribution function.
2929
pub fn new(pushers: Vec<P>, key: H) -> Exchange<T, CB, P, H> {
30-
let mut builders = vec![];
31-
for _ in 0..pushers.len() {
32-
builders.push(Default::default());
33-
}
30+
let builders = std::iter::repeat_with(Default::default).take(pushers.len()).collect();
3431
Exchange {
3532
pushers,
3633
hash_func: key,

0 commit comments

Comments
 (0)