Please sign in to comment.
Adjust SuspenseList CPU bound heuristic (#17455)
* Adjust SuspenseList CPU bound heuristic In SuspenseList we switch to rendering fallbacks (or stop rendering further rows in the case of tail="collapsed/hidden") if it takes more than 500ms to render the list. The limit of 500ms is similar to the train model and designed to be short enough to be in the not noticeable range. This works well if each row is small because we time the 500ms range well. However, if we have a few large rows then we're likely to exceed the limit by a lot. E.g. two 480ms rows hits almost a second instead of 500ms. This PR adjusts the heuristic to instead compute whether something has expired based on the render time of the last row. I.e. if we think rendering one more row would exceed the timeout, then we don't attempt. This still works well for small rows and bails earlier for large rows. The expiration is still based on the start of the list rather than the start of the render. It should probably be based on the start of the render but that's a bigger change and needs some thought. * Comment
- Loading branch information
Showing with 21 additions and 7 deletions.
- +2 −0 packages/react-reconciler/src/ReactFiberBeginWork.js
- +11 −1 packages/react-reconciler/src/ReactFiberCompleteWork.js
- +2 −0 packages/react-reconciler/src/ReactFiberSuspenseComponent.js
- +4 −4 packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js
- +2 −2 packages/react/src/__tests__/ReactDOMTracing-test.internal.js