Lower Suspense throttling heuristic to 300ms (#26803)

Now that the throttling mechanism applies more often, we've decided to
lower this a tad to ensure it's not noticeable. The idea is it should be
just large enough to prevent jank when lots of different parts of the UI
load in rapid succession, but not large enough to make the UI feel
sluggish. There's no perfect number, it's just a heuristic.

DiffTrain build for [f8de255e94](https://github.com/facebook/react/commit/f8de255e94540f9018d8196b3a34da500707c39b)
This commit is contained in:
acdlite
2023-05-16 20:05:29 +00:00
parent 7b59f84660
commit 2c5d055496
18 changed files with 56 additions and 56 deletions
+1 -1
View File
@@ -1 +1 @@
4bfcd02b2cebcb390f5aff0d7747c60a55012d5d
f8de255e94540f9018d8196b3a34da500707c39b
+1 -1
View File
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-www-modern-102b0f04";
var ReactVersion = "18.3.0-www-modern-761d713e";
// ATTENTION
// When adding new symbols to this file,
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}
var ReactVersion = "18.3.0-www-classic-ed32f0c6";
var ReactVersion = "18.3.0-www-classic-71ac99e3";
var LegacyRoot = 0;
var ConcurrentRoot = 1;
@@ -24019,7 +24019,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
+2 -2
View File
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}
var ReactVersion = "18.3.0-www-modern-c4ac5f42";
var ReactVersion = "18.3.0-www-modern-3f0beb5f";
var LegacyRoot = 0;
var ConcurrentRoot = 1;
@@ -23684,7 +23684,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -8306,7 +8306,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -9205,7 +9205,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -10193,7 +10193,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-classic-42b150af",
version: "18.3.0-www-classic-6456653a",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1323 = {
@@ -10224,7 +10224,7 @@ var internals$jscomp$inline_1323 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-42b150af"
reconcilerVersion: "18.3.0-www-classic-6456653a"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1324 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -8042,7 +8042,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -8937,7 +8937,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -9858,7 +9858,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-df668066",
version: "18.3.0-www-modern-aa16ddda",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1303 = {
@@ -9889,7 +9889,7 @@ var internals$jscomp$inline_1303 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-df668066"
reconcilerVersion: "18.3.0-www-modern-aa16ddda"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1304 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -29529,7 +29529,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -34197,7 +34197,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-classic-d76b818b";
var ReactVersion = "18.3.0-www-classic-b88f6baf";
function createPortal$1(
children,
+2 -2
View File
@@ -29379,7 +29379,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -34042,7 +34042,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-modern-df668066";
var ReactVersion = "18.3.0-www-modern-aa16ddda";
function createPortal$1(
children,
@@ -10032,7 +10032,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -11006,7 +11006,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -16653,7 +16653,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1827 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-1c8a9185",
version: "18.3.0-www-classic-c16ecf65",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2201 = {
@@ -16683,7 +16683,7 @@ var internals$jscomp$inline_2201 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-1c8a9185"
reconcilerVersion: "18.3.0-www-classic-c16ecf65"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2202 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16926,4 +16926,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-1c8a9185";
exports.version = "18.3.0-www-classic-c16ecf65";
@@ -9868,7 +9868,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -10838,7 +10838,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -16180,7 +16180,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1786 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-1a99e2f2",
version: "18.3.0-www-modern-4421b3d8",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2165 = {
@@ -16211,7 +16211,7 @@ var internals$jscomp$inline_2165 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-1a99e2f2"
reconcilerVersion: "18.3.0-www-modern-4421b3d8"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2166 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16382,4 +16382,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-1a99e2f2";
exports.version = "18.3.0-www-modern-4421b3d8";
@@ -10642,7 +10642,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now$1()),
((exitStatus = globalMostRecentFallbackTime + 300 - now$1()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -11745,7 +11745,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now$1() - globalMostRecentFallbackTime)
300 > now$1() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -17428,7 +17428,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1912 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-d3465f77",
version: "18.3.0-www-classic-9b66dabc",
rendererPackageName: "react-dom"
};
(function (internals) {
@@ -17472,7 +17472,7 @@ var devToolsConfig$jscomp$inline_1912 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-d3465f77"
reconcilerVersion: "18.3.0-www-classic-9b66dabc"
});
assign(Internals, {
ReactBrowserEventEmitter: {
@@ -17702,7 +17702,7 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-d3465f77";
exports.version = "18.3.0-www-classic-9b66dabc";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -10472,7 +10472,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now$1()),
((exitStatus = globalMostRecentFallbackTime + 300 - now$1()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -11571,7 +11571,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now$1() - globalMostRecentFallbackTime)
300 > now$1() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -16949,7 +16949,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1871 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-987c627b",
version: "18.3.0-www-modern-d9798121",
rendererPackageName: "react-dom"
};
(function (internals) {
@@ -16994,7 +16994,7 @@ var devToolsConfig$jscomp$inline_1871 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-987c627b"
reconcilerVersion: "18.3.0-www-modern-d9798121"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
@@ -17152,7 +17152,7 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-987c627b";
exports.version = "18.3.0-www-modern-d9798121";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -30146,7 +30146,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -34814,7 +34814,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-classic-4933550a";
var ReactVersion = "18.3.0-www-classic-529750af";
function createPortal$1(
children,
@@ -29996,7 +29996,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -34659,7 +34659,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-modern-67db335d";
var ReactVersion = "18.3.0-www-modern-b0d631a6";
function createPortal$1(
children,
@@ -10304,7 +10304,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -11278,7 +11278,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -16982,7 +16982,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1856 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-ed32f0c6",
version: "18.3.0-www-classic-71ac99e3",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2235 = {
@@ -17012,7 +17012,7 @@ var internals$jscomp$inline_2235 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-ed32f0c6"
reconcilerVersion: "18.3.0-www-classic-71ac99e3"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2236 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17406,4 +17406,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-ed32f0c6";
exports.version = "18.3.0-www-classic-71ac99e3";
@@ -10195,7 +10195,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
if (
(lanes & 125829120) === lanes &&
(alwaysThrottleRetries || 3 === exitStatus) &&
((exitStatus = globalMostRecentFallbackTime + 500 - now()),
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
10 < exitStatus)
) {
markRootSuspended(root, lanes);
@@ -11165,7 +11165,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) {
(3 === workInProgressRootExitStatus &&
(workInProgressRootRenderLanes & 125829120) ===
workInProgressRootRenderLanes &&
500 > now() - globalMostRecentFallbackTime)
300 > now() - globalMostRecentFallbackTime)
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
: (workInProgressRootPingedLanes |= pingedLanes));
ensureRootIsScheduled(root);
@@ -16564,7 +16564,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1815 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-102b0f04",
version: "18.3.0-www-modern-761d713e",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2199 = {
@@ -16595,7 +16595,7 @@ var internals$jscomp$inline_2199 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-102b0f04"
reconcilerVersion: "18.3.0-www-modern-761d713e"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2200 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16917,4 +16917,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-102b0f04";
exports.version = "18.3.0-www-modern-761d713e";
@@ -20627,7 +20627,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -24561,7 +24561,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-classic-f1adabbb";
var ReactVersion = "18.3.0-www-classic-0768a1ed";
// Might add PROFILE later.
@@ -20627,7 +20627,7 @@ var workInProgressRootRecoverableErrors = null; // The most recent time we eithe
// TODO: Think of a better name for this variable?
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
var FALLBACK_THROTTLE_MS = 300; // The absolute time for when we should start giving up on rendering
// more and prefer CPU suspense heuristics instead.
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
@@ -24561,7 +24561,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-www-modern-102b0f04";
var ReactVersion = "18.3.0-www-modern-761d713e";
// Might add PROFILE later.