File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
compio-runtime/src/runtime Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,11 @@ impl Driver {
135
135
}
136
136
137
137
fn poll_entries ( & mut self , entries : & mut impl Extend < Entry > ) -> bool {
138
- while let Some ( entry) = self . pool_completed . pop ( ) {
139
- entries. extend ( Some ( entry) ) ;
138
+ // Cheaper than pop.
139
+ if !self . pool_completed . is_empty ( ) {
140
+ while let Some ( entry) = self . pool_completed . pop ( ) {
141
+ entries. extend ( Some ( entry) ) ;
142
+ }
140
143
}
141
144
142
145
let mut cqueue = self . inner . completion ( ) ;
Original file line number Diff line number Diff line change @@ -83,12 +83,13 @@ impl RuntimeInner {
83
83
if let Some ( task) = next_task {
84
84
task. run ( ) ;
85
85
}
86
- let next_task = self . sync_runnables . pop ( ) ;
87
- let has_sync_task = next_task. is_some ( ) ;
88
- if let Some ( task) = next_task {
89
- task. run ( ) ;
90
- }
91
- if !has_local_task && !has_sync_task {
86
+ // Cheaper than pop.
87
+ let has_sync_task = !self . sync_runnables . is_empty ( ) ;
88
+ if has_sync_task {
89
+ if let Some ( task) = self . sync_runnables . pop ( ) {
90
+ task. run ( ) ;
91
+ }
92
+ } else if !has_local_task {
92
93
break ;
93
94
}
94
95
}
You can’t perform that action at this time.
0 commit comments