Skip to content

Commit

Permalink
reduce: remove superfluous cloning of keys (TimelyDataflow#408)
Browse files Browse the repository at this point in the history
Signed-off-by: Petros Angelatos <[email protected]>
  • Loading branch information
petrosagg authored Nov 1, 2023
1 parent 304e8c0 commit 07b987a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/operators/reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ where
while batch_cursor.key_valid(batch_storage) || exposed_position < exposed.len() {

// Determine the next key we will work on; could be synthetic, could be from a batch.
let key1 = exposed.get(exposed_position).map(|x| x.0.clone());
let key2 = batch_cursor.get_key(&batch_storage).map(|k| k.clone());
let key1 = exposed.get(exposed_position).map(|x| &x.0);
let key2 = batch_cursor.get_key(&batch_storage);
let key = match (key1, key2) {
(Some(key1), Some(key2)) => ::std::cmp::min(key1, key2),
(Some(key1), None) => key1,
Expand All @@ -514,7 +514,7 @@ where
interesting_times.clear();

// Populate `interesting_times` with synthetic interesting times (below `upper_limit`) for this key.
while exposed.get(exposed_position).map(|x| &x.0) == Some(&key) {
while exposed.get(exposed_position).map(|x| &x.0) == Some(key) {
interesting_times.push(exposed[exposed_position].1.clone());
exposed_position += 1;
}
Expand All @@ -524,7 +524,7 @@ where

// do the per-key computation.
let _counters = thinker.compute(
&key,
key,
(&mut source_cursor, source_storage),
(&mut output_cursor, output_storage),
(&mut batch_cursor, batch_storage),
Expand All @@ -535,7 +535,7 @@ where
&mut new_interesting_times,
);

if batch_cursor.get_key(batch_storage) == Some(&key) {
if batch_cursor.get_key(batch_storage) == Some(key) {
batch_cursor.step_key(batch_storage);
}

Expand Down

0 comments on commit 07b987a

Please sign in to comment.