Skip to content

Reduce animation registry copying and allocation - #58766

Closed
bartlomiejbloniarz wants to merge 2 commits into
animated-props-androidfrom
animated-props-registry
Closed

bartlomiejbloniarz wants to merge 2 commits into
animated-props-androidfrom
animated-props-registry

Conversation

@bartlomiejbloniarz

Copy link
Copy Markdown
Contributor

Summary:

For every raw update, AnimatedPropsRegistry::update copied the incoming props before merging them, and it built a full typed view-props snapshot even when no typed prop was animated. It now merges from the incoming folly::dynamic without copying it and allocates typed props only when a typed update arrives. The merge semantics (Folly's merge-patch) and the caller's input are unchanged.

On a low-end Android phone (4× Cortex-A53) with 12 views animating opacity, the registry update per frame dropped from about 0.22 ms to 0.13 ms.

The new registry tests are excluded from React-Fabric's CocoaPods and Swift Package Manager production sources.

Changelog:

[General] [Performance] - Reduce animation registry copying and allocation

Test Plan:

  • New AnimatedPropsRegistryTest cases pass on Android: recursive merges, null deletion, arrays, mixed raw and typed updates, JSI conversion and input preservation.
  • React-Fabric's CocoaPods and Swift Package Manager source lists exclude AnimatedPropsRegistryTest.cpp and still include AnimatedPropsRegistry.cpp. Not built for iOS.
  • C++ API snapshots regenerated.

Summary:

For every raw update, `AnimatedPropsRegistry::update` copied the incoming props before merging them, and it built a full typed view-props snapshot even when no typed prop was animated. It now merges from the incoming `folly::dynamic` without copying it and allocates typed props only when a typed update arrives. The merge semantics (Folly's merge-patch) and the caller's input are unchanged.

On a low-end Android phone (4× Cortex-A53) with 12 views animating opacity, the registry update per frame dropped from about 0.22 ms to 0.13 ms.

The new registry tests are excluded from React-Fabric's CocoaPods and Swift Package Manager production sources.

Changelog:

[General][Performance] - Reduce animation registry copying and allocation

Test Plan:

- New `AnimatedPropsRegistryTest` cases pass on Android: recursive merges, null deletion, arrays, mixed raw and typed updates, JSI conversion and input preservation.
- React-Fabric's CocoaPods and Swift Package Manager source lists exclude `AnimatedPropsRegistryTest.cpp` and still include `AnimatedPropsRegistry.cpp`. Not built for iOS.
- C++ API snapshots regenerated.
Tests, C++ API snapshots and Apple test-source exclusions for the change in the parent commit.
@bartlomiejbloniarz
bartlomiejbloniarz added this pull request to stack #58767 September 30, 2026 13:00
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 30, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Sep 30, 2026
@github-actions

Copy link
Copy Markdown

Caution

Invalid Changelog Format

Please verify your Changelog format. See Changelog format

Caution

Invalid Base Branch

The base branch for this PR is animated-props-android, which is not main or a -stable branch.
Are you sure you want to target this branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant