From 2ae3590e5579c61bc7b3f27ead349596a6b327f0 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 2 Nov 2020 14:23:02 -0600 Subject: [PATCH 1/2] Add new effect fields to old fork So that when comparing relative performance, we don't penalize the new fork for using more memory. --- .eslintrc.js | 2 +- packages/react-reconciler/src/ReactFiber.old.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8f88ba30a07bf..6dd119127ff47 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -122,7 +122,7 @@ module.exports = { // Disabled because it's also used by the Hook type. // 'lastEffect', ], - new: ['subtreeFlags'], + new: [], }, ], }, diff --git a/packages/react-reconciler/src/ReactFiber.old.js b/packages/react-reconciler/src/ReactFiber.old.js index 57c421e9076a5..56ef2f5a528ab 100644 --- a/packages/react-reconciler/src/ReactFiber.old.js +++ b/packages/react-reconciler/src/ReactFiber.old.js @@ -145,6 +145,8 @@ function FiberNode( this.firstEffect = null; this.lastEffect = null; + this.subtreeFlags = NoFlags; + this.deletions = null; this.lanes = NoLanes; this.childLanes = NoLanes; @@ -284,6 +286,8 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { workInProgress.nextEffect = null; workInProgress.firstEffect = null; workInProgress.lastEffect = null; + workInProgress.subtreeFlags = NoFlags; + workInProgress.deletions = null; if (enableProfilerTimer) { // We intentionally reset, rather than copy, actualDuration & actualStartTime. @@ -372,6 +376,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) { workInProgress.lanes = renderLanes; workInProgress.child = null; + workInProgress.subtreeFlags = NoFlags; workInProgress.memoizedProps = null; workInProgress.memoizedState = null; workInProgress.updateQueue = null; @@ -392,6 +397,8 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) { workInProgress.lanes = current.lanes; workInProgress.child = current.child; + workInProgress.subtreeFlags = current.subtreeFlags; + workInProgress.deletions = null; workInProgress.memoizedProps = current.memoizedProps; workInProgress.memoizedState = current.memoizedState; workInProgress.updateQueue = current.updateQueue; @@ -814,6 +821,8 @@ export function assignFiberPropertiesInDEV( target.nextEffect = source.nextEffect; target.firstEffect = source.firstEffect; target.lastEffect = source.lastEffect; + target.subtreeFlags = source.subtreeFlags; + target.deletions = source.deletions; target.lanes = source.lanes; target.childLanes = source.childLanes; target.alternate = source.alternate; From ccf2440ee0148a31a433526548e8f6d052954988 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 13 Nov 2020 09:30:30 -0600 Subject: [PATCH 2/2] 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. --- .eslintrc.js | 9 ++------- packages/react-reconciler/src/ReactFiber.new.js | 7 +++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6dd119127ff47..715c6eb96074a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -116,12 +116,7 @@ module.exports = { 'react-internal/no-cross-fork-types': [ ERROR, { - old: [ - 'firstEffect', - 'nextEffect', - // Disabled because it's also used by the Hook type. - // 'lastEffect', - ], + old: [], new: [], }, ], @@ -190,7 +185,7 @@ module.exports = { { files: [ 'packages/react-native-renderer/**/*.js', - 'packages/react-transport-native-relay/**/*.js' + 'packages/react-transport-native-relay/**/*.js', ], globals: { nativeFabricUIManager: true, diff --git a/packages/react-reconciler/src/ReactFiber.new.js b/packages/react-reconciler/src/ReactFiber.new.js index 0dcff2f776fb4..ccad1371d8f40 100644 --- a/packages/react-reconciler/src/ReactFiber.new.js +++ b/packages/react-reconciler/src/ReactFiber.new.js @@ -141,6 +141,10 @@ function FiberNode( // Effects this.flags = NoFlags; + this.nextEffect = null; + + this.firstEffect = null; + this.lastEffect = null; this.subtreeFlags = NoFlags; this.deletions = null; @@ -805,6 +809,9 @@ export function assignFiberPropertiesInDEV( target.dependencies = source.dependencies; target.mode = source.mode; target.flags = source.flags; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; target.subtreeFlags = source.subtreeFlags; target.deletions = source.deletions; target.lanes = source.lanes;