Process event-driven animations synchronously on every event (#56439)#56439
Closed
markv wants to merge 1 commit intofacebook:mainfrom
Closed
Process event-driven animations synchronously on every event (#56439)#56439markv wants to merge 1 commit intofacebook:mainfrom
markv wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@markv has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100719854. |
…k#56439) Summary: The C++ NativeAnimatedNodesManager only processes the first scroll event in a gesture synchronously via trigger()/onRender(). Subsequent events just store the updated value and defer graph traversal + prop commit to the next choreographer frame, introducing ~16ms (1 frame) latency. This differs from the Java NativeAnimatedNodesManager which calls updateNodes() → updateView() → synchronouslyUpdateViewOnUIThread() for every event with no gating. The issue was the `!isEventAnimationInProgress_` guard at line 502, which prevented trigger()/onRender() from running on the 2nd+ events. `isEventAnimationInProgress_` stays true for the entire scroll gesture (only resets when a choreographer frame produces zero changes), so every scroll event after the first was deferred. This change moves the trigger()/onRender() call outside the `!isEventAnimationInProgress_` gate so every scroll event gets immediate synchronous processing, matching the Java implementation. The startRenderCallbackIfNeeded + isEventAnimationInProgress_ setup still only happens once (first event). ## Changelog: [General] [Fixed] - Fix 1-frame latency in C++ NativeAnimatedNodesManager for event-driven animations by processing the animation graph synchronously on every scroll event, matching the Java implementation behavior Reviewed By: zeyap Differential Revision: D100719854
451c0d1 to
6279477
Compare
Collaborator
|
This pull request was successfully merged by Mark Verlingieri in 0517fb5 When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in 0517fb5. |
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:
The C++ NativeAnimatedNodesManager only processes the first scroll event in a gesture synchronously via trigger()/onRender(). Subsequent events just store the updated value and defer graph traversal + prop commit to the next choreographer frame, introducing ~16ms (1 frame) latency.
This differs from the Java NativeAnimatedNodesManager which calls updateNodes() → updateView() → synchronouslyUpdateViewOnUIThread() for every event with no gating.
The issue was the
!isEventAnimationInProgress_guard at line 502, which prevented trigger()/onRender() from running on the 2nd+ events.isEventAnimationInProgress_stays true for the entire scroll gesture (only resets when a choreographer frame produces zero changes), so every scroll event after the first was deferred.This change moves the trigger()/onRender() call outside the
!isEventAnimationInProgress_gate so every scroll event gets immediate synchronous processing, matching the Java implementation. The startRenderCallbackIfNeeded + isEventAnimationInProgress_ setup still only happens once (first event).Changelog:
[General] [Fixed] - Fix 1-frame latency in C++ NativeAnimatedNodesManager for event-driven animations by processing the animation graph synchronously on every scroll event, matching the Java implementation behavior
Reviewed By: zeyap
Differential Revision: D100719854