Skip to content

Commit

Permalink
allocate full list
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Nov 28, 2022
1 parent 38227b9 commit 8dc388d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/turbo-tasks-memory/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
borrow::Cow,
cell::RefCell,
cmp::Ordering,
cmp::{max, Ordering},
collections::{HashMap, HashSet, VecDeque},
fmt::{self, Debug, Display, Formatter, Write},
future::Future,
Expand Down Expand Up @@ -733,6 +733,9 @@ impl Task {
}
}

if queue.capacity() == 0 {
queue.reserve(max(children.len(), SPLIT_OFF_QUEUE_AT * 2));
}
queue.extend(children.iter().copied().map(|child| (child, depth + 1)));

// add to dirty list of the scope (potentially schedule)
Expand Down Expand Up @@ -898,6 +901,9 @@ impl Task {
TaskScopes::Inner(ref mut set, _) => {
if set.remove(id) {
self.remove_self_from_scope(&mut state, id, backend, turbo_tasks);
if queue.capacity() == 0 {
queue.reserve(max(state.children.len(), SPLIT_OFF_QUEUE_AT * 2));
}
queue.extend(state.children.iter().copied());
drop(state);
}
Expand Down

0 comments on commit 8dc388d

Please sign in to comment.