Skip to content

Commit a87d245

Browse files
authored
[work loop] Prevent work loop from being inlined (#16865)
Uses Closure Compiler's `@noinline` directive. See https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#noinline
1 parent 312b462 commit a87d245

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,13 +1422,16 @@ function inferTimeFromExpirationTimeWithSuspenseConfig(
14221422
);
14231423
}
14241424

1425+
// The work loop is an extremely hot path. Tell Closure not to inline it.
1426+
/** @noinline */
14251427
function workLoopSync() {
14261428
// Already timed out, so perform work without checking if we need to yield.
14271429
while (workInProgress !== null) {
14281430
workInProgress = performUnitOfWork(workInProgress);
14291431
}
14301432
}
14311433

1434+
/** @noinline */
14321435
function workLoop() {
14331436
// Perform work until Scheduler asks us to yield
14341437
while (workInProgress !== null && !shouldYield()) {

0 commit comments

Comments
 (0)