Skip to content

Commit

Permalink
Update around container traits
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed Dec 5, 2024
1 parent fb26ec0 commit 13c4f1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/consolidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use std::cmp::Ordering;
use std::collections::VecDeque;
use timely::Container;
use timely::container::{ContainerBuilder, PushInto, SizableContainer};
use timely::container::{ContainerBuilder, PushInto};
use timely::container::flatcontainer::{FlatStack, Push, Region};
use timely::container::flatcontainer::impls::tuple::{TupleABCRegion, TupleABRegion};
use crate::Data;
Expand Down Expand Up @@ -156,7 +156,7 @@ where
// TODO: Can we replace `multiple` by a bool?
#[cold]
fn consolidate_and_flush_through(&mut self, multiple: usize) {
let preferred_capacity = <Vec<(D,T,R)>>::preferred_capacity();
let preferred_capacity = timely::container::buffer::default_capacity::<(D, T, R)>();
consolidate_updates(&mut self.current);
let mut drain = self.current.drain(..(self.current.len()/multiple)*multiple).peekable();
while drain.peek().is_some() {
Expand All @@ -180,7 +180,7 @@ where
/// Precondition: `current` is not allocated or has space for at least one element.
#[inline]
fn push_into(&mut self, item: P) {
let preferred_capacity = <Vec<(D,T,R)>>::preferred_capacity();
let preferred_capacity = timely::container::buffer::default_capacity::<(D, T, R)>();
if self.current.capacity() < preferred_capacity * 2 {
self.current.reserve(preferred_capacity * 2 - self.current.capacity());
}
Expand Down
10 changes: 5 additions & 5 deletions src/trace/implementations/chunker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ where
+ PushInto<Input::ItemRef<'a>>,
{
fn push_into(&mut self, container: &'a mut Input) {
if self.pending.capacity() < Output::preferred_capacity() {
self.pending.reserve(Output::preferred_capacity() - self.pending.len());
}
self.pending.ensure_capacity(&mut None);

let form_batch = |this: &mut Self| {
if this.pending.len() == this.pending.capacity() {
if this.pending.at_capacity() {
let starting_len = this.pending.len();
consolidate_container(&mut this.pending, &mut this.empty);
std::mem::swap(&mut this.pending, &mut this.empty);
this.empty.clear();
if this.pending.len() > this.pending.capacity() / 2 {
if this.pending.len() > starting_len / 2 {
// Note that we're pushing non-full containers, which is a deviation from
// other implementation. The reason for this is that we cannot extract
// partial data from `this.pending`. We should revisit this in the future.
Expand Down

0 comments on commit 13c4f1f

Please sign in to comment.