Skip to content

Commit

Permalink
Attempt at maintaining roughly power-of-two batches
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru committed Nov 15, 2023
1 parent 61d1b71 commit e405414
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/trace/implementations/merge_batcher_col.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl<D: Ord+Clone+Columnation+'static, T: Ord+Clone+Columnation+'static, R: Semi
stack.copy(tuple);
}
self.queue.push(vec![stack]);
while self.queue.len() > 1 && (self.queue[self.queue.len()-1].len() >= self.queue[self.queue.len()-2].len() / 2) {
while self.queue.len() > 1 && (self.queue[self.queue.len()-1].len() >= self.queue[self.queue.len()-2].len() - 1) {
let list1 = self.queue.pop().unwrap();
let list2 = self.queue.pop().unwrap();
let merged = self.merge_by(list1, list2);
Expand Down Expand Up @@ -276,8 +276,9 @@ impl<D: Ord+Clone+Columnation+'static, T: Ord+Clone+Columnation+'static, R: Semi
}

if result.capacity() == result.len() {
let len = result.len();
output.push(result);
result = self.empty();
result = TimelyStack::with_capacity(len * 2);
}

if head1.is_empty() {
Expand Down

0 comments on commit e405414

Please sign in to comment.