Commit 7e4064c
committed
perf: don't reschedule the whole batch on writes
This makes flushing effects much faster in scenarios where there's a lot of effects and many of the write to state.
We added this "bail and reschedule" mechanism mainly to prevent subsequent effects from being called when a prior effect execution did e.g. cause an if block to become false and the effect about to run next therefore being destroyed.
This change addresses that issue by flushing the newly created batch right away, but only executing its branches. Through this we also get rid of the false-positive loop protection error.
The one downside is that effect execution ordering is slightly different: Only things scheduled within the current batch are executed in order, all new (pre-)effects will run afterwards. The worst thing that can happen as a result is rerunning render or user effects more often than they need to, but I expect this to be minimal in comparison to the perf wins.
Fixes #165481 parent 2e02868 commit 7e4064c
1 file changed
+26
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | 176 | | |
| 177 | + | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
213 | 218 | | |
214 | 219 | | |
215 | 220 | | |
| |||
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
| 284 | + | |
279 | 285 | | |
280 | | - | |
281 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
282 | 290 | | |
283 | 291 | | |
284 | 292 | | |
| |||
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
293 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
294 | 306 | | |
295 | 307 | | |
296 | 308 | | |
| |||
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
399 | 417 | | |
400 | 418 | | |
401 | 419 | | |
| |||
626 | 644 | | |
627 | 645 | | |
628 | 646 | | |
629 | | - | |
| 647 | + | |
630 | 648 | | |
631 | 649 | | |
632 | 650 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | 651 | | |
638 | 652 | | |
639 | 653 | | |
| |||
0 commit comments