Skip to content

Commit

Permalink
Avoid copy
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru committed Nov 14, 2023
1 parent 7b00600 commit 61d1b71
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/trace/implementations/merge_batcher_col.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ impl<B: Batch> Batcher<B> for ColumnatedMergeBatcher<B>
RefOrMut::Ref(reference) => {
// This is a moment at which we could capture the allocations backing
// `batch` into a different form of region, rather than just cloning.
// let mut owned: TimelyStack<((B::Key, B::Val), B::Time, B::R)> = self.sorter.empty();
// owned.clone_from(reference);
self.sorter.push(reference);
self.sorter.push(&mut reference.clone());
},
RefOrMut::Mut(reference) => {
self.sorter.push(reference);
Expand Down Expand Up @@ -191,12 +189,12 @@ impl<D: Ord+Clone+Columnation+'static, T: Ord+Clone+Columnation+'static, R: Semi
}

#[inline]
pub fn push(&mut self, batch: &Vec<(D, T, R)>) {
pub fn push(&mut self, batch: &mut Vec<(D, T, R)>) {

if batch.len() > 0 {
let mut batch = batch.clone();
crate::consolidation::consolidate_updates(&mut batch);
crate::consolidation::consolidate_updates(batch);
let mut stack = TimelyStack::with_capacity(batch.len());
stack.reserve_items(batch.iter());
for tuple in batch.iter() {
stack.copy(tuple);
}
Expand Down

0 comments on commit 61d1b71

Please sign in to comment.