Skip to content

Commit

Permalink
Use already extracted values instead of reading off props for control…
Browse files Browse the repository at this point in the history
…led components (#26596)

Since `props.x` is a possibly megamorphic access, it can be slow to
access and trigger recompilation.

When we are looping over the props and pattern matching every key,
anyway, we've already done this work. We can just reuse the same value
by stashing it outside the loop in the stack.

This only makes sense for updates in diffInCommitPhase since otherwise
we don't have the full set of props in that loop.

We also have to be careful not to skip over equal values since we need
to extract them anyway.

DiffTrain build for commit 6b90976.
  • Loading branch information
sebmarkbage committed Apr 11, 2023
1 parent 32f13ee commit 95cf715
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23752,7 +23752,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-343a45ffa-20230411";
var ReactVersion = "18.3.0-next-6b90976bc-20230411";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8610,7 +8610,7 @@ var devToolsConfig$jscomp$inline_1021 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1204 = {
Expand Down Expand Up @@ -8641,7 +8641,7 @@ var internals$jscomp$inline_1204 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1205 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9036,7 +9036,7 @@ var devToolsConfig$jscomp$inline_1063 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1245 = {
Expand Down Expand Up @@ -9067,7 +9067,7 @@ var internals$jscomp$inline_1245 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1246 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
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-next-343a45ffa-20230411";
var ReactVersion = "18.3.0-next-6b90976bc-20230411";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-343a45ffa-20230411";
exports.version = "18.3.0-next-6b90976bc-20230411";
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-343a45ffa-20230411";
exports.version = "18.3.0-next-6b90976bc-20230411";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
343a45ffa48065e60699bbe68f82d7b62fa02840
6b90976bc10f325146b193286435a4b5015ef605
Original file line number Diff line number Diff line change
Expand Up @@ -27059,7 +27059,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-343a45ffa-20230411";
var ReactVersion = "18.3.0-next-6b90976bc-20230411";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9479,7 +9479,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1045 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9521,7 +9521,7 @@ var internals$jscomp$inline_1274 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1275 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10188,7 +10188,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1123 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10243,7 +10243,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27572,7 +27572,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-343a45ffa-20230411";
var ReactVersion = "18.3.0-next-6b90976bc-20230411";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9738,7 +9738,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1100 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9780,7 +9780,7 @@ var internals$jscomp$inline_1343 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1344 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10447,7 +10447,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1178 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-343a45ffa-20230411",
version: "18.3.0-next-6b90976bc-20230411",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10502,7 +10502,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-343a45ffa-20230411"
reconcilerVersion: "18.3.0-next-6b90976bc-20230411"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit 95cf715

Please sign in to comment.