-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
CPU usage surge on device when not using remote debugging #13928
Comments
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! Steps to re-open:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
@hramos I vote to reopen, this seems important. |
@hramos Same issue |
My CPU go over 130% and RAM keep increasing until the app close itself -_- |
+1 |
1 similar comment
+1 |
With our project, it was a simple |
do not try to serialize vars passed by onSubmitEditing, such like: onSubmitEditing={(all)=>{
console.log(all)
}} |
Description
Our react native app flows with reasonable (not amazing) speed when developing. But when creating a release apk / ipa, we get an unusably unresponsive app. Pressing on a button takes more than 2-3 seconds to start handling the event, transition stutter etc.
We succeeded in identifying that the difference isn't between debug/release version, but between when device uses remote debugging with chrome and when it doesn't.
It doesn't matter if DEV is set to true or not and we even completely removed logging by overriding console's functions.
This happens on both iOS and android - but only (or at least much more apparent) on physical devices.
Further investigation shows that cpu usage surges drastically (watched on xcode) when not using remote debugging, even with the most basic interactions (inserting a text in a TextInput).
Reproduction Steps and Sample Code
Just typing into a TextInput will show a surge in cpu. The surge will be significantly higher when remote debugging is off.
Above you can see cpu usage of inserting a phone number in one of our screens in the app with remote debugging enabled, then a spike when I reload the app without remote debugging and then the cpu usage when inserting the same number in the same screen.
I used Android systrace to profile 5 seconds on our app of pressing a button, once with remote debugging (https://itaibs.github.io/traceChrome.html) and once without (https://itaibs.github.io/trace.html). The differences are very apparent - when no remote debugging, the js thread (and the cpus) work for more than a second and only then UI and render threads start to move. With remote debugging it looks much healthier.
Note that the above code will generate surges of ~40-50% cpu usage (for just inserting text in a text input), but in our app there is much more going on (state handling, http calls etc) and the cpu surges to way over 100% when pressing a button that changes state / starting a call etc.
Solution
No idea.
Additional Information
The text was updated successfully, but these errors were encountered: