Skip to content

Commit

Permalink
Introduce a faster version of the addProperties function (#28969)
Browse files Browse the repository at this point in the history
## Summary

This PR introduces a faster version of the `addProperties` function.
This new function is basically the `diffProperties` with `prevProps` set
to `null`, propagated constants, and all the unreachable code paths
collapsed.

## How did you test this change?

I've tested this change with [the benchmark
app](https://github.com/react-native-community/RNNewArchitectureApp/tree/new-architecture-benchmarks)
and got ~4.4% improvement in the view creation time.

DiffTrain build for [73bcdfb](73bcdfb)
  • Loading branch information
dmytrorykun committed May 2, 2024
1 parent cc2fb92 commit a73bb0e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c7b1ae5a9ed58abece101d09c47ddd1e0b181fe2
73bcdfbae57545aa8f88ecdf67426275610b5573
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-classic-f53782f7';
var ReactVersion = '19.0.0-www-classic-0ce7839f';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -160,7 +160,8 @@ var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, false is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, false is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-modern-b38d5faf';
var ReactVersion = '19.0.0-www-modern-3acd2c75';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -160,7 +160,8 @@ var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, true is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, true is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ var enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegr
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, false is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, false is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -30840,7 +30841,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-512ac9b4';
var ReactVersion = '19.0.0-www-classic-c1bcb6b8';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ var enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegr
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, true is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, true is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -30015,7 +30016,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-5ee2f667';
var ReactVersion = '19.0.0-www-modern-2f73daed';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ var enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegr
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, false is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, false is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -31403,7 +31404,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-af3b0dd2';
var ReactVersion = '19.0.0-www-classic-547fcced';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ var enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegr
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, true is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, true is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -30578,7 +30579,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-1407495b';
var ReactVersion = '19.0.0-www-modern-826b7a52';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactReconciler-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, false is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, false is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -28659,7 +28660,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-0492085a';
var ReactVersion = '19.0.0-www-classic-6ec34ee9';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactReconciler-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp,
favorSafetyOverHydrationPerf = dynamicFeatureFlags.favorSafetyOverHydrationPerf,
disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache; // On WWW, true is used for a new modern build.
enableNoCloningMemoCache = dynamicFeatureFlags.enableNoCloningMemoCache;
// On WWW, true is used for a new modern build.
var enableProfilerTimer = true;
var enableProfilerCommitHooks = true;
var enableProfilerNestedUpdatePhase = true;
Expand Down Expand Up @@ -27925,7 +27926,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-30613c5e';
var ReactVersion = '19.0.0-www-modern-e8748e87';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down

0 comments on commit a73bb0e

Please sign in to comment.