Skip to content

Commit

Permalink
Lower Suspense throttling heuristic to 300ms (#26803)
Browse files Browse the repository at this point in the history
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 [f8de255](f8de255)
  • Loading branch information
acdlite committed May 16, 2023
1 parent 7b59f84 commit 2c5d055
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4bfcd02b2cebcb390f5aff0d7747c60a55012d5d
f8de255e94540f9018d8196b3a34da500707c39b
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down Expand Up @@ -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";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down Expand Up @@ -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";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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 (
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 2c5d055

Please sign in to comment.