Skip to content

Commit

Permalink
Ship diffInCommitPhase (#27409)
Browse files Browse the repository at this point in the history
Performance tests at Meta showed neutral results.

DiffTrain build for commit 7f62018.
  • Loading branch information
sophiebits committed Sep 23, 2023
1 parent 59e0111 commit d2cd2f2
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<90d4b49133c0f3de327f45d0812fd8e9>>
* @generated SignedSource<<0e3d907c9303927e282697c3cd932853>>
*/

'use strict';
Expand Down Expand Up @@ -144,7 +144,6 @@ var enableProfilerNestedUpdatePhase = true;
var createRootStrictEffectsByDefault = false;
var enableLazyContextPropagation = false;
var enableLegacyHidden = false;
var diffInCommitPhase = true;
var enableAsyncActions = false;
var alwaysThrottleRetries = true; // Flow magic to verify the exports of this file match the original version.

Expand Down Expand Up @@ -15089,9 +15088,7 @@ function updateHostComponent(
return;
}

{
markUpdate(workInProgress);
}
markUpdate(workInProgress);
}
} // This function must be called at the very end of the complete phase, because
// it might throw to suspend, and if the resource immediately loads, the work
Expand Down Expand Up @@ -15541,7 +15538,7 @@ function completeWork(current, workInProgress, renderLanes) {
return null;
}

var _currentHostContext2 = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
var _currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
// "stack" as the parent. Then append children as we go in beginWork
// or completeWork depending on whether we want to add them top->down or
// bottom->up. Top->down is faster in IE11.
Expand All @@ -15551,19 +15548,15 @@ function completeWork(current, workInProgress, renderLanes) {
if (_wasHydrated2) {
// TODO: Move this and createInstance step into the beginPhase
// to consolidate.
if (prepareToHydrateHostInstance()) {
// If changes to the hydrated node need to be applied at the
// commit-phase we mark this as such.
markUpdate(workInProgress);
}
prepareToHydrateHostInstance();
} else {
var _rootContainerInstance = getRootHostContainer();

var _instance3 = createInstance(
_type2,
newProps,
_rootContainerInstance,
_currentHostContext2,
_currentHostContext,
workInProgress
);

Expand Down Expand Up @@ -18358,23 +18351,17 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) {
var _updatePayload = finishedWork.updateQueue;
finishedWork.updateQueue = null;

if (_updatePayload !== null || diffInCommitPhase) {
try {
commitUpdate(
_instance2,
_updatePayload,
type,
oldProps,
newProps,
finishedWork
);
} catch (error) {
captureCommitPhaseError(
finishedWork,
finishedWork.return,
error
);
}
try {
commitUpdate(
_instance2,
_updatePayload,
type,
oldProps,
newProps,
finishedWork
);
} catch (error) {
captureCommitPhaseError(finishedWork, finishedWork.return, error);
}
}
}
Expand Down Expand Up @@ -23998,7 +23985,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-d9e00f795-20230922";
var ReactVersion = "18.3.0-canary-7f6201889-20230922";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5361a5f040398d7d166b0f13b30a010c>>
* @generated SignedSource<<b1b02ea2864306d9401fff67f78939a8>>
*/

"use strict";
Expand Down Expand Up @@ -8615,19 +8615,19 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1028 = {
var devToolsConfig$jscomp$inline_1027 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-d9e00f795-20230922",
version: "18.3.0-canary-7f6201889-20230922",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1227 = {
bundleType: devToolsConfig$jscomp$inline_1028.bundleType,
version: devToolsConfig$jscomp$inline_1028.version,
rendererPackageName: devToolsConfig$jscomp$inline_1028.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1028.rendererConfig,
var internals$jscomp$inline_1226 = {
bundleType: devToolsConfig$jscomp$inline_1027.bundleType,
version: devToolsConfig$jscomp$inline_1027.version,
rendererPackageName: devToolsConfig$jscomp$inline_1027.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1027.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -8644,26 +8644,26 @@ var internals$jscomp$inline_1227 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1028.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1027.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-d9e00f795-20230922"
reconcilerVersion: "18.3.0-canary-7f6201889-20230922"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1228 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1228.isDisabled &&
hook$jscomp$inline_1228.supportsFiber
!hook$jscomp$inline_1227.isDisabled &&
hook$jscomp$inline_1227.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1228.inject(
internals$jscomp$inline_1227
(rendererID = hook$jscomp$inline_1227.inject(
internals$jscomp$inline_1226
)),
(injectedHook = hook$jscomp$inline_1228);
(injectedHook = hook$jscomp$inline_1227);
} catch (err) {}
}
exports._Scheduler = Scheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<486546c05387fd5f0f9d0c9c12aa9b75>>
* @generated SignedSource<<d7da817483638eb94b412ab9cb540ebb>>
*/

"use strict";
Expand Down Expand Up @@ -9041,19 +9041,19 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1070 = {
var devToolsConfig$jscomp$inline_1069 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-d9e00f795-20230922",
version: "18.3.0-canary-7f6201889-20230922",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1268 = {
bundleType: devToolsConfig$jscomp$inline_1070.bundleType,
version: devToolsConfig$jscomp$inline_1070.version,
rendererPackageName: devToolsConfig$jscomp$inline_1070.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1070.rendererConfig,
var internals$jscomp$inline_1267 = {
bundleType: devToolsConfig$jscomp$inline_1069.bundleType,
version: devToolsConfig$jscomp$inline_1069.version,
rendererPackageName: devToolsConfig$jscomp$inline_1069.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1069.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -9070,26 +9070,26 @@ var internals$jscomp$inline_1268 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1070.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1069.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-d9e00f795-20230922"
reconcilerVersion: "18.3.0-canary-7f6201889-20230922"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1269 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1269.isDisabled &&
hook$jscomp$inline_1269.supportsFiber
!hook$jscomp$inline_1268.isDisabled &&
hook$jscomp$inline_1268.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1269.inject(
internals$jscomp$inline_1268
(rendererID = hook$jscomp$inline_1268.inject(
internals$jscomp$inline_1267
)),
(injectedHook = hook$jscomp$inline_1269);
(injectedHook = hook$jscomp$inline_1268);
} catch (err) {}
}
exports._Scheduler = Scheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-d9e00f795-20230922";
var ReactVersion = "18.3.0-canary-7f6201889-20230922";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-d9e00f795-20230922";
exports.version = "18.3.0-canary-7f6201889-20230922";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-d9e00f795-20230922";
exports.version = "18.3.0-canary-7f6201889-20230922";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d9e00f795b77676fb14f2a3c6f421f48f73bec2a
7f6201889e8e628eeb53e05d8850ddffa3c2e74a
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01008a8950368c139ee32158a8728c5d>>
* @generated SignedSource<<bfbfdcdd5acb2e3049107f9e3d279ba1>>
*/

'use strict';
Expand Down Expand Up @@ -4997,34 +4997,28 @@ var cancelTimeout = clearTimeout;
var noTimeout = -1; // -------------------
function cloneInstance(
instance,
updatePayload,
type,
oldProps,
newProps,
internalInstanceHandle,
keepChildren,
recyclableInstance
) {
{
var viewConfig = instance.canonical.viewConfig;
updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); // TODO: If the event handlers have changed, we need to update the current props
// in the commit phase but there is no host config hook to do it yet.
// So instead we hack it by updating it in the render phase.

instance.canonical.currentProps = newProps;
}
var viewConfig = instance.canonical.viewConfig;
var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); // TODO: If the event handlers have changed, we need to update the current props
// in the commit phase but there is no host config hook to do it yet.
// So instead we hack it by updating it in the render phase.

instance.canonical.currentProps = newProps;
var node = instance.node;
var clone;

if (keepChildren) {
if (updatePayload !== null) {
clone = cloneNodeWithNewProps(node, updatePayload);
} else {
{
// No changes
return instance;
}
// No changes
return instance;
}
} else {
if (updatePayload !== null) {
Expand Down Expand Up @@ -18880,14 +18874,9 @@ function updateHostComponent(
workInProgress.stateNode = currentInstance;
return;
}

getHostContext();

var _updatePayload = null;

var newInstance = cloneInstance(
currentInstance,
_updatePayload,
type,
_oldProps,
newProps,
Expand Down Expand Up @@ -19359,7 +19348,7 @@ function completeWork(current, workInProgress, renderLanes) {
return null;
}

var _currentHostContext2 = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
var _currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
// "stack" as the parent. Then append children as we go in beginWork
// or completeWork depending on whether we want to add them top->down or
// bottom->up. Top->down is faster in IE11.
Expand All @@ -19369,19 +19358,15 @@ function completeWork(current, workInProgress, renderLanes) {
if (_wasHydrated2) {
// TODO: Move this and createInstance step into the beginPhase
// to consolidate.
if (prepareToHydrateHostInstance()) {
// If changes to the hydrated node need to be applied at the
// commit-phase we mark this as such.
markUpdate(workInProgress);
}
prepareToHydrateHostInstance();
} else {
var _rootContainerInstance = getRootHostContainer();

var _instance3 = createInstance(
_type2,
newProps,
_rootContainerInstance,
_currentHostContext2,
_currentHostContext,
workInProgress
);

Expand Down Expand Up @@ -19424,7 +19409,7 @@ function completeWork(current, workInProgress, renderLanes) {

var _rootContainerInstance2 = getRootHostContainer();

var _currentHostContext3 = getHostContext();
var _currentHostContext2 = getHostContext();

var _wasHydrated3 = popHydrationState();

Expand All @@ -19436,7 +19421,7 @@ function completeWork(current, workInProgress, renderLanes) {
workInProgress.stateNode = createTextInstance(
newText,
_rootContainerInstance2,
_currentHostContext3,
_currentHostContext2,
workInProgress
);
}
Expand Down Expand Up @@ -27037,7 +27022,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-f73f8a34";
var ReactVersion = "18.3.0-canary-b65b3ea2";

function createPortal$1(
children,
Expand Down
Loading

0 comments on commit d2cd2f2

Please sign in to comment.