Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base update capacity off updates instead of old capacity #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/trace/implementations/ord_neu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ mod val_batch {

let description = Description::new(batch1.lower().clone(), batch2.upper().clone(), since);

let batch1 = &batch1.storage;
let batch2 = &batch2.storage;
let storage1 = &batch1.storage;
let storage2 = &batch2.storage;

let mut storage = OrdValStorage {
keys: L::KeyContainer::merge_capacity(&batch1.keys, &batch2.keys),
keys_offs: L::OffsetContainer::with_capacity(batch1.keys_offs.len() + batch2.keys_offs.len()),
vals: L::ValContainer::merge_capacity(&batch1.vals, &batch2.vals),
vals_offs: L::OffsetContainer::with_capacity(batch1.vals_offs.len() + batch2.vals_offs.len()),
updates: L::UpdContainer::merge_capacity(&batch1.updates, &batch2.updates),
keys: L::KeyContainer::merge_capacity(&storage1.keys, &storage2.keys),
keys_offs: L::OffsetContainer::with_capacity(storage1.keys_offs.len() + storage2.keys_offs.len()),
vals: L::ValContainer::merge_capacity(&storage1.vals, &storage2.vals),
vals_offs: L::OffsetContainer::with_capacity(storage1.vals_offs.len() + storage2.vals_offs.len()),
updates: L::UpdContainer::with_capacity(batch1.updates + batch2.updates),
};

// Mark explicit types because type inference fails to resolve it.
Expand Down Expand Up @@ -761,13 +761,13 @@ mod key_batch {

let description = Description::new(batch1.lower().clone(), batch2.upper().clone(), since);

let batch1 = &batch1.storage;
let batch2 = &batch2.storage;
let storage1 = &batch1.storage;
let storage2 = &batch2.storage;

let mut storage = OrdKeyStorage {
keys: L::KeyContainer::merge_capacity(&batch1.keys, &batch2.keys),
keys_offs: L::OffsetContainer::with_capacity(batch1.keys_offs.len() + batch2.keys_offs.len()),
updates: L::UpdContainer::merge_capacity(&batch1.updates, &batch2.updates),
keys: L::KeyContainer::merge_capacity(&storage1.keys, &storage2.keys),
keys_offs: L::OffsetContainer::with_capacity(storage1.keys_offs.len() + storage2.keys_offs.len()),
updates: L::UpdContainer::with_capacity(batch1.updates + batch2.updates),
};

let keys_offs: &mut L::OffsetContainer = &mut storage.keys_offs;
Expand Down
14 changes: 7 additions & 7 deletions src/trace/implementations/rhh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ mod val_batch {
let max_cap = batch1.len() + batch2.len();
let rhh_cap = 2 * max_cap;

let batch1 = &batch1.storage;
let batch2 = &batch2.storage;
let storage1 = &batch1.storage;
let storage2 = &batch2.storage;

let mut storage = RhhValStorage {
keys: L::KeyContainer::merge_capacity(&batch1.keys, &batch2.keys),
keys_offs: L::OffsetContainer::with_capacity(batch1.keys_offs.len() + batch2.keys_offs.len()),
vals: L::ValContainer::merge_capacity(&batch1.vals, &batch2.vals),
vals_offs: L::OffsetContainer::with_capacity(batch1.vals_offs.len() + batch2.vals_offs.len()),
updates: L::UpdContainer::merge_capacity(&batch1.updates, &batch2.updates),
keys: L::KeyContainer::merge_capacity(&storage1.keys, &storage2.keys),
keys_offs: L::OffsetContainer::with_capacity(storage1.keys_offs.len() + storage2.keys_offs.len()),
vals: L::ValContainer::merge_capacity(&storage1.vals, &storage2.vals),
vals_offs: L::OffsetContainer::with_capacity(storage1.vals_offs.len() + storage2.vals_offs.len()),
updates: L::UpdContainer::with_capacity(batch1.updates + batch2.updates),
key_count: 0,
key_capacity: rhh_cap,
divisor: RhhValStorage::<L>::divisor_for_capacity(rhh_cap),
Expand Down
Loading