File tree 1 file changed +21
-9
lines changed
turbopack/crates/turbo-tasks/src
1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,26 @@ impl Completions {
60
60
/// Merges the list of completions into one.
61
61
#[ turbo_tasks:: function]
62
62
pub async fn completed ( & self ) -> anyhow:: Result < Vc < Completion > > {
63
- self . 0
64
- . iter ( )
65
- . map ( |& c| async move {
66
- c. await ?;
67
- Ok ( ( ) )
68
- } )
69
- . try_join ( )
70
- . await ?;
71
- Ok ( Completion :: new ( ) )
63
+ if self . 0 . len ( ) > 100 {
64
+ let mid = self . 0 . len ( ) / 2 ;
65
+ let ( left, right) = self . 0 . split_at ( mid) ;
66
+ let left = Vc :: < Completions > :: cell ( left. to_vec ( ) ) ;
67
+ let right = Vc :: < Completions > :: cell ( right. to_vec ( ) ) ;
68
+ let left = left. completed ( ) ;
69
+ let right = right. completed ( ) ;
70
+ left. await ?;
71
+ right. await ?;
72
+ Ok ( Completion :: new ( ) )
73
+ } else {
74
+ self . 0
75
+ . iter ( )
76
+ . map ( |& c| async move {
77
+ c. await ?;
78
+ Ok ( ( ) )
79
+ } )
80
+ . try_join ( )
81
+ . await ?;
82
+ Ok ( Completion :: new ( ) )
83
+ }
72
84
}
73
85
}
You can’t perform that action at this time.
0 commit comments