Repository navigation
Conversation
Contributor
Author
tomekzaw
marked this pull request as ready for review
November 12, 2026 16:34
This branch has not been deployed
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:
With
cxxNativeAnimatedEnabled, C++ Animated commits animated values into the ShadowTree throughUIManager::updateShadowTreeon frames that change layout props and on the final frame (NativeAnimatedNodesManagerProvider→MergedValueDispatcher). To find the shadow nodes for the given tags, it walks each surface breadth-first from the root, and it kept walking after every tag had been found. So every call visited every node of the surface, however few views were animating.The walk now stops as soon as
remainingTagToPropsis empty. At that point every requested node and its ancestors are already inshadowNodesToUpdatewith their depths, so the rest of the tree is never used. The enumeration across surfaces already stops on the same condition; this adds the check inside a surface.updateShadowTreeis on this path when C++ Animated is on and the shared animation backend is off: an app that turns oncxxNativeAnimatedEnabledon 0.88 or 0.89, or the experimental release level on main. The stable release level on main turns onuseSharedAnimatedBackend, which commits throughAnimationBackendand does not callupdateShadowTree.Not in this PR:
shadowNodesToUpdateis de-duplicated with a linearfind_if, which is quadratic in the number of updated nodes and their ancestors.Changelog:
[GENERAL] [CHANGED] - Stop walking the shadow tree in
UIManager::updateShadowTreeonce every requested node has been foundTest Plan:
yarn fantom 'Animated-itest|AnimatedComposition-itest|TimingAnimation-itest': 3 suites, 142 tests passed. Fantom enablescxxNativeAnimatedEnabled, andAnimated-itestruns withuseSharedAnimatedBackendboth off and on; with it off, native-driven animations commit throughupdateShadowTree.Benchmarks
RNTester release builds of this branch with and without the change, on real phones. Both builds turn on C++ Animated with
useSharedAnimatedBackendoff. The screen has 1,000 static views and 10 views whose opacity is animated with the native driver; every finished animation commits throughupdateShadowTree. Medians of a timer aroundupdateShadowTree, 6 rounds of 20 s per scenario, alternating order:🤖 Generated with Claude Code