Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
initial capacities
Browse files Browse the repository at this point in the history
  • Loading branch information
MinusKelvin committed Jul 6, 2020
1 parent 8fb7c24 commit f77ce1a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bot/src/dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl<E: Evaluation<R> + 'static, R: Clone + 'static> DagState<E, R> {
let mut to_update = vec![];
let done = gen.rent_mut(|gen| match &mut gen.children {
Children::Speculated(childs) => {
let mut newchildren = vec![];
let mut newchildren = Vec::with_capacity(childs.len());
for (j, child) in std::mem::take(childs).into_iter().enumerate() {
newchildren.push(child.and_then(|mut cases|
std::mem::take(&mut cases[piece])
Expand Down Expand Up @@ -778,22 +778,22 @@ fn build_children<'arena, E: Evaluation<R> + 'static, R: Clone + 'static>(
impl<E: 'static, R: 'static> rented::Generation<E, R> {
pub fn known(piece: Piece) -> Self {
rented::Generation::new(
Box::new(bumpalo::Bump::new()),
Box::new(bumpalo::Bump::with_capacity(1 << 20)),
|_| Generation {
nodes: vec![],
deduplicator: HashMap::new(),
children: Children::Known(piece, vec![])
nodes: Vec::with_capacity(1 << 17),
deduplicator: HashMap::with_capacity(1 << 17),
children: Children::Known(piece, Vec::with_capacity(1 << 17))
}
)
}

pub fn speculated() -> Self {
rented::Generation::new(
Box::new(bumpalo::Bump::new()),
Box::new(bumpalo::Bump::with_capacity(1 << 20)),
|_| Generation {
nodes: vec![],
deduplicator: HashMap::new(),
children: Children::Speculated(vec![])
nodes: Vec::with_capacity(1 << 17),
deduplicator: HashMap::with_capacity(1 << 17),
children: Children::Speculated(Vec::with_capacity(1 << 17))
}
)
}
Expand Down

0 comments on commit f77ce1a

Please sign in to comment.