-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Optimize {run_add_to,run_remove_from}_scope_queue #2423
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
let schedule_self = | ||
self.add_self_to_new_scope(&mut state, id, backend, turbo_tasks); | ||
drop(state); | ||
queue.extend(children.iter().copied().map(|child| (child, depth + 1))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the actual change.
); | ||
}); | ||
if queue.len() > SPLIT_OFF_QUEUE_AT { | ||
let split_off_queue = queue.split_off(SPLIT_OFF_QUEUE_AT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is now much simpler.
@@ -859,17 +860,11 @@ impl Task { | |||
TaskScopes::Inner(ref mut set, _) => { | |||
if set.remove(id) { | |||
self.remove_self_from_scope(&mut state, id, backend, turbo_tasks); | |||
let children = state.children.iter().copied().collect::<Vec<_>>(); | |||
queue.extend(state.children.iter().copied()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the actual change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better!
This PR does two things:
add_to_scope_internal_shallow
/remove_from_scope_internal_shallow
This shows improvements up to ~6% on a 5000 modules SSR benchmark:

On 20k modules, there are no significant changes.