react-native
react-native copied to clipboard
RN: Further Optimize `createAnimatedComponent`
Summary:
In addition to memoizing mergedStyle in createAnimatedComponent, this avoids unnecessary object allocations by:
- Not allocating
passthroughProps, created via a rest spread operator. It is unnecessary because we always overridestylein the JSX. - Not allocating a new object if either
styleorpassthroughStyleare null or undefined. Also, create an array of the two style objects instead of spreading them, which is needless.
Changelog:
[General][Changed] - Improved performance of Animated components
Reviewed By: sammy-SC
Differential Revision: D56621191
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 19,460,096 | -7 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 22,833,652 | +30 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: be06fd4e22a500128d202436600381b8bc17b3f5 Branch: main
Merged as https://github.com/facebook/react-native/commit/452373b5bf4469d42af722851035e5e9bc3acdb9