Repository navigation
perf(fix): experiment gate UI manager constants spread optimization - #58
Merged
Merged
Conversation
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
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.
There is a performance issue in RN where on the
UIManagerobject we have a map of[viewManagerName: view manager constants (native lookup)]Those are created as lazy properties. However, there is a
...UIManagerspread 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.
1is the above discussed,2basically disables that optimization fully. There are performance benchmarks indicating that this could be better!