Uh oh!
There was an error while loading. Please reload this page.
perf: bypass wrappers for classless native components - #640
Draft
dlebedynskyi wants to merge 3 commits into
Draft
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 freeto 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.
Motivation
withUniwindConfig currently redirects supported React Native components to Uniwind wrappers, even when an element has no Uniwind class props.
For large trees, these wrappers add React fibers and hooks to otherwise plain React Native nodes. This overhead becomes significant beyond roughly 1,000 rendered items.
Related discussion: #639
Change
Adds an experimental Metro optimization:
The option is disabled by default.
When enabled, the Metro transform redirects statically classless elements to raw React Native components before React element creation.
This removes the Uniwind wrapper fiber and hooks from classless elements without adding a runtime dispatcher.
The existing wrapper path remains the conservative fallback for:
classNameand all supported*ClassNamepropsNo application Babel configuration is required. The transform is installed internally by
withUniwindConfig.Benchmark
Android release build using Hermes and Fabric on an API 35 arm64 emulator. Each result is the median of seven measured mounts after two warm-ups.
Classless StyleSheet tree
Cross-platform benchmark report
Each platform used 12 balanced rounds and 84 samples per item count and variant. Option-on is statistically indistinguishable from raw RN while significantly outperforming option-off.
Tested on:
Android: Android 15 / API 35 arm64 emulator, 2 vCPUs, 2.5 GB guest RAM.
iOS: iPhone SE (3rd generation), iOS 18.6 arm64 simulator, Xcode 26.3.
Supported syntax
The transform recognizes:
Validation