Animated: Lazily Allocate AnimatedNode Instances#46317
Closed
yungsters wants to merge 5 commits into
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62117423 |
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62117423 |
e2a47fb to
0b3eda8
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62117423 |
0b3eda8 to
1328705
Compare
Summary: Pull Request resolved: facebook#46312 Refactors `NativeAnimatedHelper` to make it easier to read, reduce runtime overhead, and no longer export `queueOperation` (which was not useable externally anyway). Changelog: [Internal] Reviewed By: javache Differential Revision: D62139993
Summary: Pull Request resolved: facebook#46286 Optimizes the runtime performance of `Animated` by using memoization to avoid repetitive traversals of `props` (and `style`) values. Changelog: [General][Changed] - Improved runtime performance of `Animated` Reviewed By: javache Differential Revision: D62037506
Summary: Currently, `AnimatedNode.prototype.getListeners` creates an array with `Object.keys()` to determine the number of listeners. This is a relatively hot code path for animation-intensive user interfaces. Although `Object.keys()` is fast, every unnecessary memory allocation is an unnecessary opportunity to create garbage that requires collection. Using an object as a dictionary performs worst than using a `Map` anyway, so this switches `AnimatedNode` to use a `Map`. Changelog: [Internal] Differential Revision: D62267352
Summary: Currently, the logic for managing the native subscription in `AnimatedNode` is scattered and difficult to follow. This refactors the code to make the subscription's state easier to understand and harder to break in future refactors. Changelog: [Internal] Reviewed By: javache Differential Revision: D62268695
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62117423 |
1328705 to
f6290e6
Compare
Summary: Pull Request resolved: facebook#46317 Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary. This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals. Changelog: [General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object. [General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object. Reviewed By: javache Differential Revision: D62117423
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62117423 |
f6290e6 to
7f8da0a
Compare
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 8, 2024
Summary: Pull Request resolved: facebook#46317 Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary. This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals. Changelog: [General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object. [General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object. Reviewed By: javache Differential Revision: D62117423
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 8, 2024
Summary: Pull Request resolved: facebook#46317 Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary. This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals. Changelog: [General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object. [General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object. Reviewed By: javache Differential Revision: D62117423
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 9, 2024
Summary: Pull Request resolved: facebook#46317 Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary. This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals. Changelog: [General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object. [General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object. Reviewed By: javache Differential Revision: D62117423
Contributor
|
This pull request has been merged in ca234ba. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Changes
AnimatedPropsto avoid allocatingAnimatedStyle(andAnimatedTransform,AnimatedObject) unless necessary.This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals.
Changelog:
[Internal]
Differential Revision: D62117423