@samitouri / QOS-React-2 / commits / 3ebf05183d

Add new effect fields to old fork, and vice versa (#20246)

* Add new effect fields to old fork So that when comparing relative performance, we don't penalize the new fork for using more memory. * Add firstEffect, et al fields to new fork We need to bisect the changes to the recent commit phase refactor. To do this, we'll need to add back the effect list temporarily. This only adds them to the Fiber type so that the memory is the same as the old fork.

Andrew Clark committed Nov 13, 2020 at 10:09 UTC 3ebf05183dfcb8eadfc41a9e19559d835fd9b77e
3 files changed +19 -8
.eslintrc.js
+3 -8
@@ -116,13 +116,8 @@ module.exports = {
116 'react-internal/no-cross-fork-types': [
117 ERROR,
118 {
119 - old: [
120 - 'firstEffect',
121 - 'nextEffect',
122 - // Disabled because it's also used by the Hook type.
123 - // 'lastEffect',
124 - ],
125 - new: ['subtreeFlags'],
119 + old: [],
120 + new: [],
121 },
122 ],
123 },
@@ -190,7 +185,7 @@ module.exports = {
185 {
186 files: [
187 'packages/react-native-renderer/**/*.js',
193 - 'packages/react-transport-native-relay/**/*.js'
188 + 'packages/react-transport-native-relay/**/*.js',
189 ],
190 globals: {
191 nativeFabricUIManager: true,
packages/react-reconciler/src/ReactFiber.new.js
+7
@@ -141,6 +141,10 @@ function FiberNode(
141
142 // Effects
143 this.flags = NoFlags;
144 + this.nextEffect = null;
145 +
146 + this.firstEffect = null;
147 + this.lastEffect = null;
148 this.subtreeFlags = NoFlags;
149 this.deletions = null;
150
@@ -805,6 +809,9 @@ export function assignFiberPropertiesInDEV(
809 target.dependencies = source.dependencies;
810 target.mode = source.mode;
811 target.flags = source.flags;
812 + target.nextEffect = source.nextEffect;
813 + target.firstEffect = source.firstEffect;
814 + target.lastEffect = source.lastEffect;
815 target.subtreeFlags = source.subtreeFlags;
816 target.deletions = source.deletions;
817 target.lanes = source.lanes;
packages/react-reconciler/src/ReactFiber.old.js
+9
@@ -145,6 +145,8 @@ function FiberNode(
145
146 this.firstEffect = null;
147 this.lastEffect = null;
148 + this.subtreeFlags = NoFlags;
149 + this.deletions = null;
150
151 this.lanes = NoLanes;
152 this.childLanes = NoLanes;
@@ -284,6 +286,8 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
286 workInProgress.nextEffect = null;
287 workInProgress.firstEffect = null;
288 workInProgress.lastEffect = null;
289 + workInProgress.subtreeFlags = NoFlags;
290 + workInProgress.deletions = null;
291
292 if (enableProfilerTimer) {
293 // We intentionally reset, rather than copy, actualDuration & actualStartTime.
@@ -372,6 +376,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
376 workInProgress.lanes = renderLanes;
377
378 workInProgress.child = null;
379 + workInProgress.subtreeFlags = NoFlags;
380 workInProgress.memoizedProps = null;
381 workInProgress.memoizedState = null;
382 workInProgress.updateQueue = null;
@@ -392,6 +397,8 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
397 workInProgress.lanes = current.lanes;
398
399 workInProgress.child = current.child;
400 + workInProgress.subtreeFlags = current.subtreeFlags;
401 + workInProgress.deletions = null;
402 workInProgress.memoizedProps = current.memoizedProps;
403 workInProgress.memoizedState = current.memoizedState;
404 workInProgress.updateQueue = current.updateQueue;
@@ -814,6 +821,8 @@ export function assignFiberPropertiesInDEV(
821 target.nextEffect = source.nextEffect;
822 target.firstEffect = source.firstEffect;
823 target.lastEffect = source.lastEffect;
824 + target.subtreeFlags = source.subtreeFlags;
825 + target.deletions = source.deletions;
826 target.lanes = source.lanes;
827 target.childLanes = source.childLanes;
828 target.alternate = source.alternate;