Skip to content

Commit

Permalink
Add enableShallowPropDiffing feature flag (#29664)
Browse files Browse the repository at this point in the history
## Summary

We currently do deep diffing for object props, and also use custom
differs, if they are defined, for props with custom attribute config.

The idea is to simply do a `===` comparison instead of all that work. We
will do less computation on the JS side, but send more data to native.

The hypothesis is that this change should be neutral in terms of
performance. If that's the case, we'll be able to get rid of custom
differs, and be one step closer to deleting view configs.

This PR adds the `enableShallowPropDiffing` feature flag to support this
experiment.

## How did you test this change?

With `enableShallowPropDiffing` hardcoded to `true`:
```
yarn test packages/react-native-renderer
```
This fails on the following test cases:
- should use the diff attribute
- should do deep diffs of Objects by default
- should skip deeply-nested changed functions

Which makes sense with this change. These test cases should be deleted
if the experiment is shipped.

DiffTrain build for [eb259b5](eb259b5)
  • Loading branch information
dmytrorykun committed Jun 5, 2024
1 parent d3308e2 commit e0ef1b2
Show file tree
Hide file tree
Showing 34 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a26e90c29cfa841d3e2bc08876c5929d5680fb6d
eb259b5d3b20b053dc0444e6ae442774c396c4a7
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a26e90c29cfa841d3e2bc08876c5929d5680fb6d
eb259b5d3b20b053dc0444e6ae442774c396c4a7
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = '19.0.0-www-classic-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-classic-eb259b5d3b-20240605';

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require('ReactFeatureFlags');
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = '19.0.0-www-modern-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-modern-eb259b5d3b-20240605';

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require('ReactFeatureFlags');
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-a26e90c29c-20240604";
exports.version = "19.0.0-www-classic-eb259b5d3b-20240605";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-a26e90c29c-20240604";
exports.version = "19.0.0-www-modern-eb259b5d3b-20240605";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-a26e90c29c-20240604";
exports.version = "19.0.0-www-classic-eb259b5d3b-20240605";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-a26e90c29c-20240604";
exports.version = "19.0.0-www-modern-eb259b5d3b-20240605";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-classic-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-classic-eb259b5d3b-20240605';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -166,7 +166,7 @@ var enableAsyncActions = true;
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var disableLegacyMode = false;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-modern-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-modern-eb259b5d3b-20240605';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -166,7 +166,7 @@ var enableAsyncActions = true;
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var disableLegacyMode = true;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10674,7 +10674,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-classic-a26e90c29c-20240604",
version: "19.0.0-www-classic-eb259b5d3b-20240605",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1371 = {
Expand Down Expand Up @@ -10705,7 +10705,7 @@ var internals$jscomp$inline_1371 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-classic-eb259b5d3b-20240605"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1372 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10149,7 +10149,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-modern-a26e90c29c-20240604",
version: "19.0.0-www-modern-eb259b5d3b-20240605",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1357 = {
Expand Down Expand Up @@ -10180,7 +10180,7 @@ var internals$jscomp$inline_1357 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-modern-eb259b5d3b-20240605"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1358 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var enableSuspenseCallback = true;
var disableLegacyMode = false;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -31138,7 +31138,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-classic-eb259b5d3b-20240605';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var enableSuspenseCallback = true;
var disableLegacyMode = true;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -30315,7 +30315,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-modern-eb259b5d3b-20240605';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17081,14 +17081,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1754 = React.version;
if (
"19.0.0-www-classic-a26e90c29c-20240604" !==
"19.0.0-www-classic-eb259b5d3b-20240605" !==
isomorphicReactPackageVersion$jscomp$inline_1754
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1754,
"19.0.0-www-classic-a26e90c29c-20240604"
"19.0.0-www-classic-eb259b5d3b-20240605"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17107,7 +17107,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1761 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-a26e90c29c-20240604",
version: "19.0.0-www-classic-eb259b5d3b-20240605",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2205 = {
Expand Down Expand Up @@ -17137,7 +17137,7 @@ var internals$jscomp$inline_2205 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-classic-eb259b5d3b-20240605"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2206 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17641,4 +17641,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-a26e90c29c-20240604";
exports.version = "19.0.0-www-classic-eb259b5d3b-20240605";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16444,14 +16444,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1725 = React.version;
if (
"19.0.0-www-modern-a26e90c29c-20240604" !==
"19.0.0-www-modern-eb259b5d3b-20240605" !==
isomorphicReactPackageVersion$jscomp$inline_1725
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1725,
"19.0.0-www-modern-a26e90c29c-20240604"
"19.0.0-www-modern-eb259b5d3b-20240605"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -16470,7 +16470,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1727 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-a26e90c29c-20240604",
version: "19.0.0-www-modern-eb259b5d3b-20240605",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2196 = {
Expand Down Expand Up @@ -16500,7 +16500,7 @@ var internals$jscomp$inline_2196 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-modern-eb259b5d3b-20240605"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2197 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16874,4 +16874,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-a26e90c29c-20240604";
exports.version = "19.0.0-www-modern-eb259b5d3b-20240605";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17848,14 +17848,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1841 = React.version;
if (
"19.0.0-www-classic-a26e90c29c-20240604" !==
"19.0.0-www-classic-eb259b5d3b-20240605" !==
isomorphicReactPackageVersion$jscomp$inline_1841
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1841,
"19.0.0-www-classic-a26e90c29c-20240604"
"19.0.0-www-classic-eb259b5d3b-20240605"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17874,7 +17874,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1848 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-a26e90c29c-20240604",
version: "19.0.0-www-classic-eb259b5d3b-20240605",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17918,7 +17918,7 @@ var devToolsConfig$jscomp$inline_1848 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-classic-eb259b5d3b-20240605"
});
function ReactDOMRoot(internalRoot) {
this._internalRoot = internalRoot;
Expand Down Expand Up @@ -18409,7 +18409,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-a26e90c29c-20240604";
exports.version = "19.0.0-www-classic-eb259b5d3b-20240605";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17194,14 +17194,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1812 = React.version;
if (
"19.0.0-www-modern-a26e90c29c-20240604" !==
"19.0.0-www-modern-eb259b5d3b-20240605" !==
isomorphicReactPackageVersion$jscomp$inline_1812
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1812,
"19.0.0-www-modern-a26e90c29c-20240604"
"19.0.0-www-modern-eb259b5d3b-20240605"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17220,7 +17220,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1814 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-a26e90c29c-20240604",
version: "19.0.0-www-modern-eb259b5d3b-20240605",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17264,7 +17264,7 @@ var devToolsConfig$jscomp$inline_1814 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-a26e90c29c-20240604"
reconcilerVersion: "19.0.0-www-modern-eb259b5d3b-20240605"
});
function ReactDOMRoot(internalRoot) {
this._internalRoot = internalRoot;
Expand Down Expand Up @@ -17625,7 +17625,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-a26e90c29c-20240604";
exports.version = "19.0.0-www-modern-eb259b5d3b-20240605";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require('react');
var ReactDOM = require('react-dom');

var ReactVersion = '19.0.0-www-classic-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-classic-eb259b5d3b-20240605';

// This refers to a WWW module.
var warningWWW = require('warning');
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require('react');
var ReactDOM = require('react-dom');

var ReactVersion = '19.0.0-www-modern-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-modern-eb259b5d3b-20240605';

// This refers to a WWW module.
var warningWWW = require('warning');
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5695,4 +5695,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.0.0-www-classic-a26e90c29c-20240604";
exports.version = "19.0.0-www-classic-eb259b5d3b-20240605";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -5673,4 +5673,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.0.0-www-modern-a26e90c29c-20240604";
exports.version = "19.0.0-www-modern-eb259b5d3b-20240605";
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var enableSuspenseCallback = true;
var disableLegacyMode = false;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -31704,7 +31704,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-classic-eb259b5d3b-20240605';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableAsyncIterableChildren = false;
var enableSuspenseCallback = true;
var disableLegacyMode = true;
var enableOwnerStacks = false; // Flow magic to verify the exports of this file match the original version.
var enableOwnerStacks = false;

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -30881,7 +30881,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-a26e90c29c-20240604';
var ReactVersion = '19.0.0-www-modern-eb259b5d3b-20240605';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
Loading

0 comments on commit e0ef1b2

Please sign in to comment.