Skip to content

Commit e200fda

Browse files
committed
Efficient Exchange::new
Construct the container builder vector directly instead of pushing at it. Signed-off-by: Moritz Hoffmann <[email protected]>
1 parent 85ce6cd commit e200fda

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)