Skip to content

Commit c75e4c7

Browse files
sokrahuozhi
authored andcommitted
Turbopack: use batch add to add initial followers (#85624)
### What? use batch add to convert children to followers
1 parent f4ca795 commit c75e4c7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

turbopack/crates/turbo-tasks-backend/src/backend/operation/aggregation_update.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ use crate::{
3131
storage::{count, get, get_many, iter_many, remove, update, update_count},
3232
},
3333
data::{
34-
ActivenessState, AggregationNumber, CachedDataItem, CachedDataItemKey, CollectibleRef,
35-
DirtyContainerCount,
34+
ActivenessState, AggregationNumber, CachedDataItem, CachedDataItemKey, CachedDataItemType,
35+
CollectibleRef, DirtyContainerCount,
3636
},
3737
utils::swap_retain,
3838
};
@@ -2295,12 +2295,12 @@ impl AggregationUpdateQueue {
22952295
// When converted from leaf to aggregating node, all children become
22962296
// followers
22972297
let children: Vec<_> = get_many!(task, Child { task } => task);
2298-
for child_id in children {
2299-
task.add_new(CachedDataItem::Follower {
2300-
task: child_id,
2301-
value: 1,
2302-
});
2303-
}
2298+
task.extend_new(
2299+
CachedDataItemType::Follower,
2300+
children
2301+
.iter()
2302+
.map(|&task| CachedDataItem::Follower { task, value: 1 }),
2303+
);
23042304
}
23052305

23062306
if is_aggregating_node(aggregation_number) {

0 commit comments

Comments
 (0)