@samitouri / QOS-React / commits / df12d7eac4

[www] reduce dynamic SchedulerFeatureFlags (#26617)

For these values we're not using dynamic values. We can statically compile in the values we're running.

Jan Kassens committed May 10, 2023 at 17:26 UTC df12d7eac40c87bd5fdde0aa5a739bce9e7dce27
3 files changed +13 -23
packages/scheduler/src/__tests__/Scheduler-test.js
+4 -4
@@ -344,7 +344,7 @@ describe('SchedulerBrowser', () => {
344 // about, like a network event.
345 gate(flags =>
346 flags.enableIsInputPending
347 - ? 'Yield at 300ms'
347 + ? 'Yield at 10ms'
348 : // When isInputPending is disabled, we always yield quickly
349 'Yield at 5ms',
350 ),
@@ -398,7 +398,7 @@ describe('SchedulerBrowser', () => {
398 // about, like a network event.
399 gate(flags =>
400 flags.enableIsInputPending
401 - ? 'Yield at 300ms'
401 + ? 'Yield at 10ms'
402 : // When isInputPending is disabled, we always yield quickly
403 'Yield at 5ms',
404 ),
@@ -423,7 +423,7 @@ describe('SchedulerBrowser', () => {
423 // as quickly as for a discrete event.
424 gate(flags =>
425 flags.enableIsInputPending
426 - ? 'Yield at 50ms'
426 + ? 'Yield at 10ms'
427 : // When isInputPending is disabled, we always yield quickly
428 'Yield at 5ms',
429 ),
@@ -453,7 +453,7 @@ describe('SchedulerBrowser', () => {
453 'Task with no paint',
454 gate(flags =>
455 flags.enableIsInputPending
456 - ? 'Yield at 300ms'
456 + ? 'Yield at 10ms'
457 : // When isInputPending is disabled, we always yield quickly
458 'Yield at 5ms',
459 ),
packages/scheduler/src/forks/SchedulerFeatureFlags.www-dynamic.js
-6
@@ -11,10 +11,4 @@
11 // Use __VARIANT__ to simulate a GK. The tests will be run twice: once
12 // with the __VARIANT__ set to `true`, and once set to `false`.
13
14 -export const enableIsInputPending = __VARIANT__;
15 -export const enableSchedulerDebugging = __VARIANT__;
14 export const enableProfiling = __VARIANT__;
17 -export const enableIsInputPendingContinuous = __VARIANT__;
18 -export const frameYieldMs = 5;
19 -export const continuousYieldMs = 50;
20 -export const maxYieldMs = 300;
packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
+9 -13
@@ -7,19 +7,15 @@
7 * @flow
8 */
9
10 -// $FlowFixMe[cannot-resolve-module]
11 -const dynamicFeatureFlags = require('SchedulerFeatureFlags');
12 -
13 -// Re-export dynamic flags from the www version.
14 -export const {
15 - enableIsInputPending,
16 - enableSchedulerDebugging,
17 - enableProfiling: enableProfilingFeatureFlag,
18 - enableIsInputPendingContinuous,
19 - frameYieldMs,
20 - continuousYieldMs,
21 - maxYieldMs,
22 -} = dynamicFeatureFlags;
10 +const {enableProfiling: enableProfilingFeatureFlag} =
11 + // $FlowFixMe[cannot-resolve-module]
12 + require('SchedulerFeatureFlags');
13
14 +export const enableSchedulerDebugging = true;
15 export const enableProfiling: boolean =
16 __PROFILE__ && enableProfilingFeatureFlag;
17 +export const enableIsInputPending = true;
18 +export const enableIsInputPendingContinuous = true;
19 +export const frameYieldMs = 5;
20 +export const continuousYieldMs = 10;
21 +export const maxYieldMs = 10;