Revert "Scheduling profiler updates (#19334)" (#19366)
This reverts commit 6d7555b014513125b0c229b9c6e45c903d974ff7.
Dominic Gannaway committed
Jul 15, 2020 at 12:36 UTC
392277f0abc2251ea93b7debad4ae86cd0f1bdff
10 files changed
+15
-269
packages/react-reconciler/src/ReactFiberClassComponent.new.js
+1
-47
@@ -16,8 +16,6 @@ import {Update, Snapshot} from './ReactSideEffectTags';
16
import {
17
debugRenderPhaseSideEffectsForStrictMode,
18
disableLegacyContext,
19
- enableDebugTracing,
20
- enableSchedulingProfiler,
19
warnAboutDeprecatedLifecycles,
20
} from 'shared/ReactFeatureFlags';
21
import ReactStrictModeWarnings from './ReactStrictModeWarnings.new';
@@ -29,7 +27,7 @@ import invariant from 'shared/invariant';
27
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
28
29
import {resolveDefaultProps} from './ReactFiberLazyComponent.new';
32
-import {DebugTracingMode, StrictMode} from './ReactTypeOfMode';
30
+import {StrictMode} from './ReactTypeOfMode';
31
32
import {
33
enqueueUpdate,
@@ -57,13 +55,8 @@ import {
55
scheduleUpdateOnFiber,
56
} from './ReactFiberWorkLoop.new';
57
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
60
-import {logForceUpdateScheduled, logStateUpdateScheduled} from './DebugTracing';
58
59
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
63
-import {
64
- markForceUpdateScheduled,
65
- markStateUpdateScheduled,
66
-} from './SchedulingProfiler';
60
61
const fakeInternalInstance = {};
62
const isArray = Array.isArray;
@@ -210,19 +203,6 @@ const classComponentUpdater = {
203
204
enqueueUpdate(fiber, update);
205
scheduleUpdateOnFiber(fiber, lane, eventTime);
213
-
214
- if (__DEV__) {
215
- if (enableDebugTracing) {
216
- if (fiber.mode & DebugTracingMode) {
217
- const name = getComponentName(fiber.type) || 'Unknown';
218
- logStateUpdateScheduled(name, lane, payload);
219
- }
220
- }
221
- }
222
-
223
- if (enableSchedulingProfiler) {
224
- markStateUpdateScheduled(fiber, lane);
225
- }
206
},
207
enqueueReplaceState(inst, payload, callback) {
208
const fiber = getInstance(inst);
@@ -243,19 +223,6 @@ const classComponentUpdater = {
223
224
enqueueUpdate(fiber, update);
225
scheduleUpdateOnFiber(fiber, lane, eventTime);
246
-
247
- if (__DEV__) {
248
- if (enableDebugTracing) {
249
- if (fiber.mode & DebugTracingMode) {
250
- const name = getComponentName(fiber.type) || 'Unknown';
251
- logStateUpdateScheduled(name, lane, payload);
252
- }
253
- }
254
- }
255
-
256
- if (enableSchedulingProfiler) {
257
- markStateUpdateScheduled(fiber, lane);
258
- }
226
},
227
enqueueForceUpdate(inst, callback) {
228
const fiber = getInstance(inst);
@@ -275,19 +242,6 @@ const classComponentUpdater = {
242
243
enqueueUpdate(fiber, update);
244
scheduleUpdateOnFiber(fiber, lane, eventTime);
278
-
279
- if (__DEV__) {
280
- if (enableDebugTracing) {
281
- if (fiber.mode & DebugTracingMode) {
282
- const name = getComponentName(fiber.type) || 'Unknown';
283
- logForceUpdateScheduled(name, lane);
284
- }
285
- }
286
- }
287
-
288
- if (enableSchedulingProfiler) {
289
- markForceUpdateScheduled(fiber, lane);
290
- }
245
},
246
};
247
packages/react-reconciler/src/ReactFiberHooks.new.js
+2
-21
@@ -24,13 +24,9 @@ import type {FiberRoot} from './ReactInternalTypes';
24
import type {OpaqueIDType} from './ReactFiberHostConfig';
25
26
import ReactSharedInternals from 'shared/ReactSharedInternals';
27
-import {
28
- enableDebugTracing,
29
- enableSchedulingProfiler,
30
- enableNewReconciler,
31
-} from 'shared/ReactFeatureFlags';
27
+import {enableNewReconciler} from 'shared/ReactFeatureFlags';
28
33
-import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
29
+import {NoMode, BlockingMode} from './ReactTypeOfMode';
30
import {
31
NoLane,
32
NoLanes,
@@ -92,8 +88,6 @@ import {
88
warnAboutMultipleRenderersDEV,
89
} from './ReactMutableSource.new';
90
import {getIsRendering} from './ReactCurrentFiber';
95
-import {logStateUpdateScheduled} from './DebugTracing';
96
-import {markStateUpdateScheduled} from './SchedulingProfiler';
91
92
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
93
@@ -1757,19 +1751,6 @@ function dispatchAction<S, A>(
1751
}
1752
scheduleUpdateOnFiber(fiber, lane, eventTime);
1753
}
1760
-
1761
- if (__DEV__) {
1762
- if (enableDebugTracing) {
1763
- if (fiber.mode & DebugTracingMode) {
1764
- const name = getComponentName(fiber.type) || 'Unknown';
1765
- logStateUpdateScheduled(name, lane, action);
1766
- }
1767
- }
1768
- }
1769
-
1770
- if (enableSchedulingProfiler) {
1771
- markStateUpdateScheduled(fiber, lane);
1772
- }
1754
}
1755
1756
export const ContextOnlyDispatcher: Dispatcher = {
packages/react-reconciler/src/ReactFiberReconciler.new.js
-6
@@ -39,7 +39,6 @@ import {
39
} from './ReactWorkTags';
40
import getComponentName from 'shared/getComponentName';
41
import invariant from 'shared/invariant';
42
-import {enableSchedulingProfiler} from 'shared/ReactFeatureFlags';
42
import ReactSharedInternals from 'shared/ReactSharedInternals';
43
import {getPublicInstance} from './ReactFiberHostConfig';
44
import {
@@ -96,7 +95,6 @@ import {
95
setRefreshHandler,
96
findHostInstancesForRefresh,
97
} from './ReactFiberHotReloading.new';
99
-import {markRenderScheduled} from './SchedulingProfiler';
98
99
export {registerMutableSourceForHydration} from './ReactMutableSource.new';
100
export {createPortal} from './ReactPortal';
@@ -275,10 +273,6 @@ export function updateContainer(
273
const suspenseConfig = requestCurrentSuspenseConfig();
274
const lane = requestUpdateLane(current, suspenseConfig);
275
278
- if (enableSchedulingProfiler) {
279
- markRenderScheduled(lane);
280
- }
281
-
276
const context = getContextForSubtree(parentComponent);
277
if (container.context === null) {
278
container.context = context;
packages/react-reconciler/src/ReactFiberThrow.new.js
+1
-20
@@ -31,11 +31,7 @@ import {
31
ForceUpdateForLegacySuspense,
32
} from './ReactSideEffectTags';
33
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.new';
34
-import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
35
-import {
36
- enableDebugTracing,
37
- enableSchedulingProfiler,
38
-} from 'shared/ReactFeatureFlags';
34
+import {NoMode, BlockingMode} from './ReactTypeOfMode';
35
import {createCapturedValue} from './ReactCapturedValue';
36
import {
37
enqueueCapturedUpdate,
@@ -58,8 +54,6 @@ import {
54
pingSuspendedRoot,
55
} from './ReactFiberWorkLoop.new';
56
import {logCapturedError} from './ReactFiberErrorLogger';
61
-import {logComponentSuspended} from './DebugTracing';
62
-import {markComponentSuspended} from './SchedulingProfiler';
57
58
import {
59
SyncLane,
@@ -196,19 +190,6 @@ function throwException(
190
// This is a wakeable.
191
const wakeable: Wakeable = (value: any);
192
199
- if (__DEV__) {
200
- if (enableDebugTracing) {
201
- if (sourceFiber.mode & DebugTracingMode) {
202
- const name = getComponentName(sourceFiber.type) || 'Unknown';
203
- logComponentSuspended(name, wakeable);
204
- }
205
- }
206
- }
207
-
208
- if (enableSchedulingProfiler) {
209
- markComponentSuspended(sourceFiber, wakeable);
210
- }
211
-
193
if ((sourceFiber.mode & BlockingMode) === NoMode) {
194
// Reset the memoizedState to what it was before we attempted
195
// to render it.
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
-147
@@ -27,8 +27,6 @@ import {
27
warnAboutUnmockedScheduler,
28
deferRenderPhaseUpdateToNextBatch,
29
decoupleUpdatePriorityFromScheduler,
30
- enableDebugTracing,
31
- enableSchedulingProfiler,
30
enableScopeAPI,
31
} from 'shared/ReactFeatureFlags';
32
import ReactSharedInternals from 'shared/ReactSharedInternals';
@@ -49,27 +47,6 @@ import {
47
flushSyncCallbackQueue,
48
scheduleSyncCallback,
49
} from './SchedulerWithReactIntegration.new';
52
-import {
53
- logCommitStarted,
54
- logCommitStopped,
55
- logLayoutEffectsStarted,
56
- logLayoutEffectsStopped,
57
- logPassiveEffectsStarted,
58
- logPassiveEffectsStopped,
59
- logRenderStarted,
60
- logRenderStopped,
61
-} from './DebugTracing';
62
-import {
63
- markCommitStarted,
64
- markCommitStopped,
65
- markLayoutEffectsStarted,
66
- markLayoutEffectsStopped,
67
- markPassiveEffectsStarted,
68
- markPassiveEffectsStopped,
69
- markRenderStarted,
70
- markRenderYielded,
71
- markRenderStopped,
72
-} from './SchedulingProfiler';
50
51
// The scheduler is imported here *only* to detect whether it's been mocked
52
import * as Scheduler from 'scheduler';
@@ -1532,16 +1509,6 @@ function renderRootSync(root: FiberRoot, lanes: Lanes) {
1509
1510
const prevInteractions = pushInteractions(root);
1511
1535
- if (__DEV__) {
1536
- if (enableDebugTracing) {
1537
- logRenderStarted(lanes);
1538
- }
1539
- }
1540
-
1541
- if (enableSchedulingProfiler) {
1542
- markRenderStarted(lanes);
1543
- }
1544
-
1512
do {
1513
try {
1514
workLoopSync();
@@ -1567,16 +1534,6 @@ function renderRootSync(root: FiberRoot, lanes: Lanes) {
1534
);
1535
}
1536
1570
- if (__DEV__) {
1571
- if (enableDebugTracing) {
1572
- logRenderStopped();
1573
- }
1574
- }
1575
-
1576
- if (enableSchedulingProfiler) {
1577
- markRenderStopped();
1578
- }
1579
-
1537
// Set this to null to indicate there's no in-progress render.
1538
workInProgressRoot = null;
1539
workInProgressRootRenderLanes = NoLanes;
@@ -1607,16 +1564,6 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
1564
1565
const prevInteractions = pushInteractions(root);
1566
1610
- if (__DEV__) {
1611
- if (enableDebugTracing) {
1612
- logRenderStarted(lanes);
1613
- }
1614
- }
1615
-
1616
- if (enableSchedulingProfiler) {
1617
- markRenderStarted(lanes);
1618
- }
1619
-
1567
do {
1568
try {
1569
workLoopConcurrent();
@@ -1633,25 +1580,12 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
1580
popDispatcher(prevDispatcher);
1581
executionContext = prevExecutionContext;
1582
1636
- if (__DEV__) {
1637
- if (enableDebugTracing) {
1638
- logRenderStopped();
1639
- }
1640
- }
1641
-
1583
// Check if the tree has completed.
1584
if (workInProgress !== null) {
1585
// Still work remaining.
1645
- if (enableSchedulingProfiler) {
1646
- markRenderYielded();
1647
- }
1586
return RootIncomplete;
1587
} else {
1588
// Completed the tree.
1651
- if (enableSchedulingProfiler) {
1652
- markRenderStopped();
1653
- }
1654
-
1589
// Set this to null to indicate there's no in-progress render.
1590
workInProgressRoot = null;
1591
workInProgressRootRenderLanes = NoLanes;
@@ -1934,28 +1868,7 @@ function commitRootImpl(root, renderPriorityLevel) {
1868
1869
const finishedWork = root.finishedWork;
1870
const lanes = root.finishedLanes;
1937
-
1938
- if (__DEV__) {
1939
- if (enableDebugTracing) {
1940
- logCommitStarted(lanes);
1941
- }
1942
- }
1943
-
1944
- if (enableSchedulingProfiler) {
1945
- markCommitStarted(lanes);
1946
- }
1947
-
1871
if (finishedWork === null) {
1949
- if (__DEV__) {
1950
- if (enableDebugTracing) {
1951
- logCommitStopped();
1952
- }
1953
- }
1954
-
1955
- if (enableSchedulingProfiler) {
1956
- markCommitStopped();
1957
- }
1958
-
1872
return null;
1873
}
1874
root.finishedWork = null;
@@ -2246,16 +2159,6 @@ function commitRootImpl(root, renderPriorityLevel) {
2159
}
2160
2161
if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
2249
- if (__DEV__) {
2250
- if (enableDebugTracing) {
2251
- logCommitStopped();
2252
- }
2253
- }
2254
-
2255
- if (enableSchedulingProfiler) {
2256
- markCommitStopped();
2257
- }
2258
-
2162
// This is a legacy edge case. We just committed the initial mount of
2163
// a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
2164
// synchronously, but layout updates should be deferred until the end
@@ -2266,16 +2169,6 @@ function commitRootImpl(root, renderPriorityLevel) {
2169
// If layout work was scheduled, flush it now.
2170
flushSyncCallbackQueue();
2171
2269
- if (__DEV__) {
2270
- if (enableDebugTracing) {
2271
- logCommitStopped();
2272
- }
2273
- }
2274
-
2275
- if (enableSchedulingProfiler) {
2276
- markCommitStopped();
2277
- }
2278
-
2172
return null;
2173
}
2174
@@ -2407,16 +2300,6 @@ function commitMutationEffects(root: FiberRoot, renderPriorityLevel) {
2300
}
2301
2302
function commitLayoutEffects(root: FiberRoot, committedLanes: Lanes) {
2410
- if (__DEV__) {
2411
- if (enableDebugTracing) {
2412
- logLayoutEffectsStarted(committedLanes);
2413
- }
2414
- }
2415
-
2416
- if (enableSchedulingProfiler) {
2417
- markLayoutEffectsStarted(committedLanes);
2418
- }
2419
-
2303
// TODO: Should probably move the bulk of this function to commitWork.
2304
while (nextEffect !== null) {
2305
setCurrentDebugFiberInDEV(nextEffect);
@@ -2443,16 +2326,6 @@ function commitLayoutEffects(root: FiberRoot, committedLanes: Lanes) {
2326
resetCurrentDebugFiberInDEV();
2327
nextEffect = nextEffect.nextEffect;
2328
}
2446
-
2447
- if (__DEV__) {
2448
- if (enableDebugTracing) {
2449
- logLayoutEffectsStopped();
2450
- }
2451
- }
2452
-
2453
- if (enableSchedulingProfiler) {
2454
- markLayoutEffectsStopped();
2455
- }
2329
}
2330
2331
export function flushPassiveEffects() {
@@ -2542,16 +2415,6 @@ function flushPassiveEffectsImpl() {
2415
'Cannot flush passive effects while already rendering.',
2416
);
2417
2545
- if (__DEV__) {
2546
- if (enableDebugTracing) {
2547
- logPassiveEffectsStarted(lanes);
2548
- }
2549
- }
2550
-
2551
- if (enableSchedulingProfiler) {
2552
- markPassiveEffectsStarted(lanes);
2553
- }
2554
-
2418
if (__DEV__) {
2419
isFlushingPassiveEffects = true;
2420
}
@@ -2708,16 +2571,6 @@ function flushPassiveEffectsImpl() {
2571
isFlushingPassiveEffects = false;
2572
}
2573
2711
- if (__DEV__) {
2712
- if (enableDebugTracing) {
2713
- logPassiveEffectsStopped();
2714
- }
2715
- }
2716
-
2717
- if (enableSchedulingProfiler) {
2718
- markPassiveEffectsStopped();
2719
- }
2720
-
2574
executionContext = prevExecutionContext;
2575
2576
flushSyncCallbackQueue();
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+1
-1
@@ -1361,7 +1361,7 @@ function handleError(root, thrownValue): void {
1361
// sibling, or the parent if there are no siblings. But since the root
1362
// has no siblings nor a parent, we set it to null. Usually this is
1363
// handled by `completeUnitOfWork` or `unwindWork`, but since we're
1364
- // intentionally not calling those, we need set it here.
1364
+ // interntionally not calling those, we need set it here.
1365
// TODO: Consider calling `unwindWork` to pop the contexts.
1366
workInProgress = null;
1367
return;
packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js
+6
-24
@@ -351,14 +351,8 @@ describe('SchedulingProfiler', () => {
351
expect(Scheduler).toFlushUntilNextPaint([]);
352
}).toErrorDev('Cannot update during an existing state transition');
353
354
- gate(({old}) =>
355
- old
356
- ? expect(marks.map(normalizeCodeLocInfo)).toContain(
357
- '--schedule-state-update-1024-Example-\n in Example (at **)',
358
- )
359
- : expect(marks.map(normalizeCodeLocInfo)).toContain(
360
- '--schedule-state-update-512-Example-\n in Example (at **)',
361
- ),
354
+ expect(marks.map(normalizeCodeLocInfo)).toContain(
355
+ '--schedule-state-update-1024-Example-\n in Example (at **)',
356
);
357
});
358
@@ -384,14 +378,8 @@ describe('SchedulingProfiler', () => {
378
expect(Scheduler).toFlushUntilNextPaint([]);
379
}).toErrorDev('Cannot update during an existing state transition');
380
387
- gate(({old}) =>
388
- old
389
- ? expect(marks.map(normalizeCodeLocInfo)).toContain(
390
- '--schedule-forced-update-1024-Example-\n in Example (at **)',
391
- )
392
- : expect(marks.map(normalizeCodeLocInfo)).toContain(
393
- '--schedule-forced-update-512-Example-\n in Example (at **)',
394
- ),
381
+ expect(marks.map(normalizeCodeLocInfo)).toContain(
382
+ '--schedule-forced-update-1024-Example-\n in Example (at **)',
383
);
384
});
385
@@ -473,14 +461,8 @@ describe('SchedulingProfiler', () => {
461
ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});
462
});
463
476
- gate(({old}) =>
477
- old
478
- ? expect(marks.map(normalizeCodeLocInfo)).toContain(
479
- '--schedule-state-update-1024-Example-\n in Example (at **)',
480
- )
481
- : expect(marks.map(normalizeCodeLocInfo)).toContain(
482
- '--schedule-state-update-512-Example-\n in Example (at **)',
483
- ),
464
+ expect(marks.map(normalizeCodeLocInfo)).toContain(
465
+ '--schedule-state-update-1024-Example-\n in Example (at **)',
466
);
467
});
468
});
packages/shared/ReactFeatureFlags.js
+1
-1
@@ -17,7 +17,7 @@ export const enableDebugTracing = false;
17
18
// Adds user timing marks for e.g. state updates, suspense, and work loop stuff,
19
// for an experimental scheduling profiler tool.
20
-export const enableSchedulingProfiler = __PROFILE__ && __EXPERIMENTAL__;
20
+export const enableSchedulingProfiler = false;
21
22
// Helps identify side effects in render-phase lifecycle hooks and setState
23
// reducers by double invoking them in Strict Mode.
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
+2
-1
@@ -19,8 +19,9 @@ export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
19
export const enableLegacyFBSupport = __VARIANT__;
20
export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
21
22
-// TODO: This feature does not currently exist in the new reconciler fork.
22
+// TODO: These features do not currently exist in the new reconciler fork.
23
export const enableDebugTracing = !__VARIANT__;
24
+export const enableSchedulingProfiler = !__VARIANT__ && __PROFILE__;
25
26
// This only has an effect in the new reconciler. But also, the new reconciler
27
// is only enabled when __VARIANT__ is true. So this is set to the opposite of
packages/shared/forks/ReactFeatureFlags.www.js
+1
-1
@@ -26,6 +26,7 @@ export const {
26
deferRenderPhaseUpdateToNextBatch,
27
decoupleUpdatePriorityFromScheduler,
28
enableDebugTracing,
29
+ enableSchedulingProfiler,
30
enableFormEventDelegation,
31
} = dynamicFeatureFlags;
32
@@ -34,7 +35,6 @@ export const {
35
36
export const enableProfilerTimer = __PROFILE__;
37
export const enableProfilerCommitHooks = __PROFILE__;
37
-export const enableSchedulingProfiler = __PROFILE__;
38
39
// Note: we'll want to remove this when we to userland implementation.
40
// For now, we'll turn it on for everyone because it's *already* on for everyone in practice.