-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Issues with React Native Bridgeless Architecture #47490
Comments
Warning Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2. |
Warning Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2. |
Warning Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:
|
Yes we would need an isolated reproducer to look into this. |
I agree, there are lots of lags and crashes. |
i know this isnt particularly helpful to most others, but i also oberved performance degradation when migrating my app to bridgeless. my sprcific issue is react-navigation drawer opening is particularly choppy and wont switch screens completely. this is not exactly the rn teams fault, but the general DX/UX of our apps are still impacted |
@lovegaoshi did you manage to fix that choppy drawer animation? The new architecture heavily slows down my app, is there any timeline for fixing this? |
unfortunately no. im reliant on react navigation and react native paper,
and both have minor but unacceptable UX issues that i could not upgrade to
the new arch with. right now im reinventing the wheel to write my own ui
lib and migrate away from these ui libs.
given other important libs like rn firebase or notifee also breaks, its
peobably the best to not chase the newest feature.
…On Wed, Nov 13, 2024, 11:43 AM Joost ***@***.***> wrote:
@lovegaoshi <https://github.com/lovegaoshi> did you manage to fix that
choppy drawer animation? The new architecture heavily slows down my app, is
there any timeline for fixing this?
—
Reply to this email directly, view it on GitHub
<#47490 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZMOVVT3NCGMGDL4IRIDT732AOTXLAVCNFSM6AAAAABRLKPMCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZUGU4TKMJRG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I can also confirm that the new arch is causing a few performance issues regarding responsiveness, I can notice a significant lag in catching touch events when doing things quickly which may indicate the blocking nature of synchronous events? Also a few bugs where Views seem to always fade / animate when layout changes or Text with adjustToFitSize and "unacceptable" lineHeight completely bug out but these are different issues. |
Yeah the navigation and the overall responsiveness is horrible for me. I really hope this gets fixed because other than the performance issues, the new architecture is very promising. @santhoshkumarvgds are you able to create a minimal reproducible example? |
I just wanted to add that on our project (which is quite massive but well-maintained), we also see significant performance degradations in debug mode on RN 0.76, even with the new architecture turned off. The problem might be related to hermes, which has steadily declined in performance over the past few releases. Can anyone confirm that 0.76 + new arch disabled also causes performance regressions? |
I haven't tested without the new arch. But I can confirm that it's probably related to Hermes as the JS frames are very low which makes the app unresponsive. |
okay, im probably able to provide a repo soon(tm). i have a MotionLayout
equivalent component just built from scratch using reanimated and gesture
handler, and new arch is noticably choppier than old.
…On Thu, Nov 14, 2024, 10:49 AM Joost ***@***.***> wrote:
I haven't tested without the new arch. But I can confirm that it's
probably related to Hermes as the JS frames are very low which makes the
app unresponsive.
—
Reply to this email directly, view it on GitHub
<#47490 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZMOVVQCYXGRUJDMZ7BAZVD2ATWENAVCNFSM6AAAAABRLKPMCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZXGE3TEOBUHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
here for android. I have a MotionLayout (black bar at the bottom) that drags to expand to fullscreen. This is fluid with the old arch, new arch without expo's stack component, new arch with flatlist, but choppy with new arch and expo's stack or flashlist. im not sure how useful this actually is, as this is an expo template (nowadays loaded with expo bloats. i used it for convenience) rather than a reproducer, and technically all react native components work as expected, just 3rd party libs are not. not sure who to ping to get visibility. |
We have similar issues both in Android and iOS for our app running RN 0.76.2. |
Unfortunately, I have to completely agree with this. I spent the whole week, full of anticipation and euphoria, painstakingly converting our app to the new architecture. |
@cortinico @cipolleschi any chance the React Native team can look into this with the reproducer from @lovegaoshi? It's not feasible for me to provide my company repo for obvious reasons, and creating a new project is not going to truly reflect the performance regressions in more complex applications. I find it hard to believe that Meta is using 0.76 internally unless it is really a case of user error, but it seems unlikely as many people are facing this issue. To reiterate, here is my "minimally reproducing setup" on a complex application:
Performance is terrible on debug builds but seemingly faster than 0.75 on production, so the performance impact is only felt in debug mode. However, it makes for a horrendous development experience. Making changes and interactions take seconds. I believe 0.76 has been the most insidious upgrade cycle because the changes according to the upgrade helper are minimal, but there are so many invisible moving parts under-the-hood that makes it impossible for us to have a reasonable timeline for any action items to pinpoint any sort of root cause. Many of us have to build features for our companies and upgrading should not be this tedious. Although I greatly appreciate the work that the Meta team have put into this release, it has been an impossible one for us, and this is very worrying for the future of my company project due to the tight deprecation cycles in the React Native ecosystem. |
@thespacemanatee I'm so sorry to hear that it is not working for you.
At Meta we use React Native from main, the latest commit available, and yes, all our internal app are using or are migrating to the New Architecture. We might have some extra fix that we shipped between the branch cut of 0.76 (beginning of September) and today, but I can't think of anything that might dramatically change the performances of the app running in Debug. Is this happening for Android, iOS, or both of them? Without a reproducer is pretty hard for us to do any work. The issue you are facing might be coming not from React Native core but from some external libraries you are using. Multiple people are reporting the issues, so I'm not downplaying them, I'm sure they are there and real. It would be quite helpful to try and find the minimum common denominator of the set of libraries or patterns that are causing the slowness. |
@cipolleschi Thank you so much for the response.
Both of them are slow in debug mode. Both are fast in production mode. On our end, we will try to reverse engineer and determine whether an external dependency is causing this debug performance regression. The current list of dependencies we are using is reputable though as far as I can tell, comparing it against https://reactnative.directory/. Also, CMIIW, but Bluesky is still using RN 0.74? Do they have a branch where they have validated that 0.76 + New Arch runs smoothly? EDIT: They have a 0.76 branch that seems to be inactive currently, maybe someone from the team can chime in about the issues they are facing with upgrading. |
Small consolation, but for those of you running react navigation as your navigation package, it appears that native stack navigators run slightly faster than "normal" stack navigators for screen transitions. |
@thespacemanatee can you try something for me. On iOS, can you try to modify the def self.add_ndebug_flag_to_pods_in_release(installer)
ndebug_flag = " -DNDEBUG"
installer.aggregate_targets.each do |aggregate_target|
aggregate_target.xcconfigs.each do |config_name, config_file|
- is_release = config_name.downcase.include?("release") || config_name.downcase.include?("production")
- unless is_release
- next
- end
self.add_flag_to_map_with_inheritance(config_file.attributes, 'OTHER_CPLUSPLUSFLAGS', ndebug_flag);
self.add_flag_to_map_with_inheritance(config_file.attributes, 'OTHER_CFLAGS', ndebug_flag);
xcconfig_path = aggregate_target.xcconfig_path(config_name)
config_file.save_as(xcconfig_path)
end
end
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
target_installation_result.native_target.build_configurations.each do |config|
- is_release = config.name.downcase.include?("release") || config.name.downcase.include?("production")
- unless is_release
- next
- end
self.add_flag_to_map_with_inheritance(config.build_settings, 'OTHER_CPLUSPLUSFLAGS', ndebug_flag);
self.add_flag_to_map_with_inheritance(config.build_settings, 'OTHER_CFLAGS', ndebug_flag);
end
end
end Then reinstall pods and try again? What this does is basically to set the NDEBUG flag to every build config. This should disable some expensive runtime checks we are doing in debug mode to ensure the correctness of the framework. Those checks are disabled in production so that could be one of the causes why Debug is slower than development. AFAIK, Bluesky made an Android release with the New Architecture that they asked users to try. I think they are also doing a phased rollout using the Play Store, but I am not completely sure. |
@cipolleschi Thanks for the suggestion but unfortunately it's still as slow as before, though at least we can probably rule out NDEBUG as the root cause. |
To set expectation, I'll be off next week and @cortinico will be back on Thursday. We will try to prioritize this once we are back. |
Hello @cortinico thanks for the response. Are we doing something that we aren't supposed to then? Are these apps using packages like reanimated, gesture hander etc. from the example repo or are they using the Animated API directly from the react-native repo? |
Each RN version since 0.72 is worse than version before in terms of performance mainly due to JS thread overload. Moving parts of heavy JS code to native improves things, but that's all with old arch. New arch never worked, a lot of lags, constant freezes, etc. Bridgeless crashes immediately after start. An app has a of libs, mostly from expo. |
its a difficult problem that roots from meta, but ultimately caused by 3rd party libs that meta has no control over (or they elected to be, after meta spun out their libs to be 3rd party supported). unfortunately we are at this stage of pointing fingers where meta strictly only supports whatever their core lib is (which is actually fine by all means), 3rd party is often unmaintained (look at react-native-paper's new arch support fiasco, and many others that arent even doing it yet) and probably is fine until you and me the devs combine them in a weird manner, and all we saw is simply switching the newarch flag caused a huge performance degradation. lastly there is probably nothing anyone can do except for you and me the devs. identify what element is lagging, literally remove everything else and decide if its still lagging; if so make it into a reproducer here. else slowly add the elements back. this is debug 101 that we all should be familiar of at this point. get the chrome profiler and start profiling. ===== Screencast.from.01-14-2025.11.09.33.AM.webm |
Sadly that's kinda hard to say. I'm reading this conversation daily and I'm seeing generic messages about 'performance regressions' between old and new arch, without metrics or actual proof that there is actually a regression. Historically, we always had folks in the community sharing that newer version 'feels slower' than older one. However, we validated with our partners and with real metrics that this is not the case. During 2023/2024 we fixed a number of performance regressions that were reported by the community, but those came with a isolated reproducer + with graphs showing how the framerate dropped before/after. Sadly, just commenting on this issue saying that the app feels 'slower' is not doing any help. The best we can all do is isolate a reproducer and identify a small set of libraries or APIs that are regressing (if any) on the New Architecture. |
For performance in debug mode, we had a lengthy investigation on the Bluesky app that seems to point to the If you are using this component in your app, can you try to remove it and report back whether it improves the performance? Meanwhile, we are investigating why this is slow and how can we improve it. This could improve the performance when the app is in Debug mode, not in Release mode. |
We are not using the Profiler. |
@santhoshkumarvgds just to clarify, what do you mean with N API calls? Are those network calls? Is the performance issue still reproducing for you if you don't make network requests? (Btw, if they're network requests, dispatching 32 network requests in any client interaction seems like a bad pattern that will lead to a bad experience in general). |
@hosseinmd @cipolleschi I'll have a look on that 👀 |
@hosseinmd okay, I took a project @ustuncem and pasted your code (keeping Screen.Recording.2025-01-16.at.19.36.11.mov@hosseinmd may I kindly ask you to upload your project to GitHub and share a video what exactly you are doing to get a crash? Using your code I'm not able able to reproduce any freezes 🤷♂ Alternatively you can go to |
@hosseinmd Okay, it seems like some styles were missing - if I add After quick debugging it seems like it happens only if Reanimated handler is attached to a view (i. e. I think it's reanimated issue, but I will try to debug it further tomorrow to have a 100% confidence in my words 🙂 |
@kirillzyusko thank you so much for looking into this. |
@kirillzyusko This could be a recursive commit problem. There is a fix for that in the newest RN version. |
@bartlomiejbloniarz could you add the link of fix please |
I think this PR might help, but I didn't check. |
@bartlomiejbloniarz I confirm, if I update @hosseinmd @ustuncem can you try to update RN to |
The fix seems only for Android, so I assume this doesn't fix the performance problem in iOS debug builds? |
@JustJoostNL the repro provided by @ustuncem contained information about Android issues only. I tested iOS and it works well there. Do you have a reproduction example which shows the problem on iOS? |
@kirillzyusko @bartlomiejbloniarz hello, I will test it as soon as I can thanks for the update. I am not using any drawer navigation so maybe that's why my repro didn't experience any performance issues on iOS. As @lovegaoshi pointed out here:
It maybe because of how views with uninitted heights interact with the parent content that is provided from @react-navigation/drawer. Another project that I am currently developing is migrated to react-native 0.76 without enabling the new arch. I also updated the react-navigation packages to version 7.x.x. I immediatly noticed performance issues even when not enabling the new arch. Drawer's opening and closing animations are extremely laggy on debug(Haven't tested in production yet.) but when downgrading drawer navigation to version 6.7.2, lags are gone. So this maybe about what changed in @react-navigation/drawer on version 7.x.x rather than a new arch problem. Should we open an issue there as well? Edit: Screen.Recording.2025-01-21.at.18.03.13.movThis one here is with react native version 0.76.3 and new arch disabled. @react-navigation/drawer version is 6.7.2 Screen.Recording.2025-01-21.at.18.07.05.mov |
Tested on iOS also: Screen.Recording.2025-01-21.at.18.28.53.movWith React Native 0.76.6, the new architecture disabled, and @react-navigation/drawer version 7.1.1: Disabling the new architecture significantly reduces flickering. I will try to provide a reproduction example for this issue. Unfortunately, I can't open source the project as my company doesn't allow it. I'm unsure where to report this issue. Should I continue discussing it here, or should I open an issue in the react-navigation repository? Any guidance would be greatly appreciated. |
I've been testing it for more than 10 minutes and issue seems to have been gone. No crashes/freezes happening on Samsung Galaxy S22. Thanks for looking into this. At least it seems like I can ship it in new arch now.
|
@ustuncem with new arch enabled does disabling react-native-screens help with the flickering/performance? I noticed the flickering disappeared when using drawer version 6.7.2 on Android with enableScreens(false) in root of project: import { enableScreens } from "react-native-screens" |
Hello, thank you for the response. I will test it tonight and notify you. |
Just to clarify, Bluesky app is not yet working perfectly with the New Architecture. We don't want to migrate until it runs at least as good or better, and for now it's not there yet. I've commented with latest issues we're discovering in bluesky-social/social-app#6755 so this will be an ongoing process until we can confidently cut over. |
I'm experiencing significant performance issues on iOS since I upgraded from SDK 51 to 52. Already, I had to disable the new architecture (my application was literally broken). Then, the flashlist lost considerable performance. But still, navigating from one screen to another is sometimes tedious. Anyone else have this problem? Thank you for your feedback. |
Hi @ustuncem. Regarding
I think that the answer is yes, it is expected (cc. @cortinico who has more Android expertise). The reason is that the New Arch is basically a rewrite of the Old Arch in C++ so we can share code between iOS and Android. The New Arch has some extra code that we need to build and that could account for those extra MB. @LouisSyfer have you tried opening an issue on Expo repository? |
@cipolleschi hi ! No I did not open an issue on the Expo repository. But I talk about it on Expo Discord server. For the moment, I don't have any answer. And anyway I can't provide an Minimal reproducible example. All I can say : it's was working very well with expo sdk 51. And the loss of performance happens with the old and new arch. Only with my iOS app (on Android it works well!). |
Description
The Bridgeless Architecture in React Native 0.74 and later introduces significant performance issues, particularly for apps with complex logic and high demands for UI responsiveness. Here are the main concerns:
Key Issues
1. Screen Load Times
2. UI Responsiveness and Touch Lag
3. Lazy Module Loading
Comparative Performance with Older Versions
Attempts to Improve Performance
Call for Optimizations
The React Native community and core team are urged to provide optimizations or alternative solutions to enhance performance under the bridgeless architecture.
Feedback Needed: Community support and solutions for the architectural limitations causing these performance issues.
Steps to reproduce
Expected: Slower performance in the bridgeless versions.
React Native Version
0.74+
Affected Platforms
Runtime - Android, Runtime - iOS
Areas
Bridgeless - The New Initialization Flow, Other (please specify)
Output of
npx react-native info
Stacktrace or Logs
Reproducer
Reproducer: Unfortunately, I cannot provide a public repository or Expo Snack at this time. Please let me know if you would like further details or an isolated example of the issue.
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: