Commit 37c942e
committed
Track "pending" and "suspended" ranges
A FiberRoot can have pending work at many distinct priorities. (Note: we
refer to these levels as "expiration times" to distinguish the concept
from Scheduler's notion of priority levels, which represent broad
categories of work. React expiration times are more granualar. They're
more like a concurrent thread ID, which also happens to correspond to a
moment on a timeline. It's an overloaded concept and I'm handwaving over
some of the details.)
Given a root, there's no convenient way to read all the pending levels
in the entire tree, i.e. there's no single queue-like structure that
tracks all the levels, because that granularity of information is not
needed by our algorithms. Instead we track the subset of information
that we actually need — most importantly, the highest priority level
that exists in the entire tree.
Aside from that, the other information we track includes the range of
pending levels that are known to be suspended, and therefore should not
be worked on.
This is a refactor of how that information is tracked, and what each
field represents:
- A *pending* level is work that is unfinished, or not yet committed.
This includes work that is suspended from committing.
`firstPendingTime` and `lastPendingTime` represent the range of
pending work. (Previously, "pending" was the same as "not suspended.")
- A *suspended* level is work that did not complete because data was
missing. `firstSuspendedTime` and `lastSuspendedTime` represent the
range of suspended work. It is a subset of the pending range. (These
fields are new to this commit.)
- `nextAfterSuspendedTime` represents the next known level that comes
after the suspended range.
This commit doesn't change much in terms of observable behavior. The one
change is that, when a level is suspended, React will continue working
on the next known level instead of jumping straight to the last pending
level. Subsequent commits will use this new structure for a more
substantial refactor for how tasks are scheduled per root.1 parent 9ce8711 commit 37c942e
File tree
3 files changed
+196
-42
lines changed- packages/react-reconciler/src
- __tests__
3 files changed
+196
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
120 | 127 | | |
121 | 128 | | |
122 | 129 | | |
123 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| |||
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
377 | 382 | | |
378 | 383 | | |
379 | 384 | | |
380 | | - | |
381 | | - | |
382 | 385 | | |
383 | 386 | | |
384 | 387 | | |
| |||
492 | 495 | | |
493 | 496 | | |
494 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
495 | 501 | | |
496 | 502 | | |
497 | 503 | | |
| |||
807 | 813 | | |
808 | 814 | | |
809 | 815 | | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | 816 | | |
818 | 817 | | |
819 | 818 | | |
| |||
831 | 830 | | |
832 | 831 | | |
833 | 832 | | |
834 | | - | |
835 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
849 | 852 | | |
850 | 853 | | |
851 | 854 | | |
| |||
958 | 961 | | |
959 | 962 | | |
960 | 963 | | |
961 | | - | |
| 964 | + | |
| 965 | + | |
962 | 966 | | |
963 | 967 | | |
964 | 968 | | |
| |||
1002 | 1006 | | |
1003 | 1007 | | |
1004 | 1008 | | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
1005 | 1014 | | |
1006 | 1015 | | |
1007 | 1016 | | |
| |||
1038 | 1047 | | |
1039 | 1048 | | |
1040 | 1049 | | |
1041 | | - | |
1042 | | - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1043 | 1053 | | |
1044 | 1054 | | |
1045 | | - | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1046 | 1064 | | |
1047 | 1065 | | |
1048 | 1066 | | |
| |||
1058 | 1076 | | |
1059 | 1077 | | |
1060 | 1078 | | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1061 | 1084 | | |
1062 | 1085 | | |
1063 | 1086 | | |
| |||
1077 | 1100 | | |
1078 | 1101 | | |
1079 | 1102 | | |
1080 | | - | |
1081 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1082 | 1106 | | |
1083 | | - | |
1084 | | - | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
1085 | 1117 | | |
1086 | 1118 | | |
1087 | 1119 | | |
| |||
1425 | 1457 | | |
1426 | 1458 | | |
1427 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1428 | 1468 | | |
1429 | 1469 | | |
1430 | 1470 | | |
| |||
1540 | 1580 | | |
1541 | 1581 | | |
1542 | 1582 | | |
1543 | | - | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1551 | 1588 | | |
1552 | 1589 | | |
1553 | | - | |
| 1590 | + | |
1554 | 1591 | | |
1555 | 1592 | | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
1556 | 1596 | | |
1557 | 1597 | | |
1558 | 1598 | | |
| |||
2148 | 2188 | | |
2149 | 2189 | | |
2150 | 2190 | | |
2151 | | - | |
2152 | | - | |
| 2191 | + | |
2153 | 2192 | | |
2154 | 2193 | | |
2155 | 2194 | | |
2156 | 2195 | | |
2157 | | - | |
2158 | | - | |
| 2196 | + | |
| 2197 | + | |
2159 | 2198 | | |
2160 | 2199 | | |
2161 | 2200 | | |
2162 | 2201 | | |
2163 | 2202 | | |
2164 | | - | |
| 2203 | + | |
2165 | 2204 | | |
2166 | 2205 | | |
2167 | 2206 | | |
| |||
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
521 | 578 | | |
522 | 579 | | |
523 | 580 | | |
| |||
0 commit comments