Skip to content

perf(fix): experiment gate UI manager constants spread optimization - #58

Merged
hannojg merged 8 commits into
0.86.0-discordfrom
fix/ui-manager-constants-spread
Oct 15, 2026
Merged

hannojg merged 8 commits into
0.86.0-discordfrom
fix/ui-manager-constants-spread

Conversation

@hannojg

@hannojg hannojg commented Oct 15, 2026 •

Copy link
Copy Markdown

There is a performance issue in RN where on the UIManager object we have a map of [viewManagerName: view manager constants (native lookup)]
Those are created as lazy properties. However, there is a ...UIManager spread in the final implementation which causes all lazy properties to be evaluated lazily.
Funny enough, this was fixed in RN yesterday:

However, we want to gate that change behind an experiment to be able to measure its impact, which this PR adds the infra for on top of the original change


This PR actually now contains two UIManager related experiment treatments. 1 is the above discussed, 2 basically disables that optimization fully. There are performance benchmarks indicating that this could be better!

fairysword and others added 8 commits October 15, 2026 10:39
Summary:
- Preserve lazy ViewManager property descriptors when composing UIManager.
- Avoid eagerly invoking lazy ViewManager getters and unnecessary getConstantsForViewManager calls during Bridgeless initialization.
- Add regression coverage for lazy, own, enumerable and one-time getter behavior.
- Platform scope: This targets the Android Bridgeless lazy ViewManager path. iOS does not currently expose this lazy getter path, so no iOS runtime behavior or performance change is expected.

[ANDROID] [FIXED] - Avoid unnecessary getConstantsForViewManager calls during UIManager initialization.

Pull Request resolved: react#58097

Test Plan:
- `yarn flow-check`
- `yarn test packages/react-native/Libraries/ReactNative --runInBand`
- `yarn lint --quiet`
- `yarn format-check`
- Verified with Android RNTester offlineDebug that startup no longer triggers eager getConstantsForViewManager calls.

Reviewed By: cipolleschi

Differential Revision: D124967747

Pulled By: javache

fbshipit-source-id: 1a4daf139b555ed266d5a7d3a0b90ebb02cfe5be
@hannojg
hannojg merged commit 3129062 into 0.86.0-discord Oct 15, 2026
38 checks passed
@hannojg
hannojg deleted the fix/ui-manager-constants-spread branch October 15, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants