-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Animated: Optimize Traversals in Nodes #46286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
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
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62037506 |
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62037506 |
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 3, 2024
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
e4f0b19 to
312d76f
Compare
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 3, 2024
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
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 3, 2024
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: Pull Request resolved: facebook#46318 Configures the Metro by default to use the Hermes parser so that React Native can fully leverage all modern Flow language syntax. NOTE: This does not affect `*.ts` and `*.tsx` files which will continue to use Babel. Metro has logic to enforce this regardless of the transform options. Changelog: [General][Changed] - Changed Metro default config to use Hermes parser, enabling the use of advanced Flow syntax in React Native. Differential Revision: D62161923
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
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 4, 2024
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
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62037506 |
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 4, 2024
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
312d76f to
bdcf72d
Compare
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
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D62037506 |
bdcf72d to
3485763
Compare
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 6, 2024
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
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 6, 2024
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
yungsters
added a commit
to yungsters/react-native
that referenced
this pull request
Sep 6, 2024
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
Contributor
|
This pull request has been merged in d1ebe02. |
rozele
added a commit
to rozele/react-native-macos
that referenced
this pull request
Sep 16, 2024
Summary: There's an interesting behavior in Animated where we effectively perform an O(N + M) traversal of the Animated graph, calling `__makeNative` on each "input", which in turn tends to call `__makeNative` on each "output" (so we revisit the current node M times when calling `__makeNative` on the M inputs). In practice, the behavior is still O(N), because M is small and finite (most Animated nodes have 1 or 2 inputs). All that said, some platforms (e.g., react-native-windows) rely on this revisiting behavior, where on the first visit, we recurse the node to its inputs, and on the subsequent visit, we update the `_platformConfig` value without recursion (see facebook#32736 for the original change adding platformConfig). A recent change to AnimatedWithChildren (facebook#46286) eagerly invokes `__getNativeTag` on AnimatedWithChildren in the initial recursion step, which forces materialization of the NativeAnimated node *before* it's `_platformConfig` is set. There is certainly some refactoring that needs to be done to improve all this, but for now, this change reverts to delay the call to `__getNativeTag` until after at least one `__makeNative` occurs on an input. Differential Revision: D62768179
rozele
added a commit
to rozele/react-native-macos
that referenced
this pull request
Sep 16, 2024
Summary: Pull Request resolved: facebook#46524 There's an interesting behavior in Animated where we effectively perform an O(N + M) traversal of the Animated graph, calling `__makeNative` on each "input", which in turn tends to call `__makeNative` on each "output" (so we revisit the current node M times when calling `__makeNative` on the M inputs). In practice, the behavior is still O(N), because M is small and finite (most Animated nodes have 1 or 2 inputs). All that said, some platforms (e.g., react-native-windows) rely on this revisiting behavior, where on the first visit, we recurse the node to its inputs, and on the subsequent visit, we update the `_platformConfig` value without recursion (see facebook#32736 for the original change adding platformConfig). A recent change to AnimatedWithChildren (facebook#46286) eagerly invokes `__getNativeTag` on AnimatedWithChildren in the initial recursion step, which forces materialization of the NativeAnimated node *before* it's `_platformConfig` is set. There is certainly some refactoring that needs to be done to improve all this, but for now, this change reverts to delay the call to `__getNativeTag` until after at least one `__makeNative` occurs on an input. ## Changelog [General][Fixed]: Order of operations related to platformConfig propagation in NativeAnimated Reviewed By: yungsters Differential Revision: D62768179
facebook-github-bot
pushed a commit
that referenced
this pull request
Sep 16, 2024
Summary: Pull Request resolved: #46524 There's an interesting behavior in Animated where we effectively perform an O(N + M) traversal of the Animated graph, calling `__makeNative` on each "input", which in turn tends to call `__makeNative` on each "output" (so we revisit the current node M times when calling `__makeNative` on the M inputs). In practice, the behavior is still O(N), because M is small and finite (most Animated nodes have 1 or 2 inputs). All that said, some platforms (e.g., react-native-windows) rely on this revisiting behavior, where on the first visit, we recurse the node to its inputs, and on the subsequent visit, we update the `_platformConfig` value without recursion (see #32736 for the original change adding platformConfig). A recent change to AnimatedWithChildren (#46286) eagerly invokes `__getNativeTag` on AnimatedWithChildren in the initial recursion step, which forces materialization of the NativeAnimated node *before* it's `_platformConfig` is set. There is certainly some refactoring that needs to be done to improve all this, but for now, this change reverts to delay the call to `__getNativeTag` until after at least one `__makeNative` occurs on an input. ## Changelog [General][Fixed]: Order of operations related to platformConfig propagation in NativeAnimated Reviewed By: yungsters Differential Revision: D62768179 fbshipit-source-id: ca9d911503e0630bc3a1309b21f9686aa77ac8b9
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.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
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:
Optimizes the runtime performance of
Animatedby using memoization to avoid repetitive traversals ofprops(andstyle) values.Changelog:
[General][Changed] - Improved runtime performance of
AnimatedDifferential Revision: D62037506