React native runs slow on ios device when remote debugger is off

(Daniel) #1

I run into this issue when try to run app on ios device(ipad4,ios10).
The app runs slow on device when remote debugger is off, if remote js debugger is on, then it runs pretty fine.
I also tried react-native run-ios --configuration Release, but its still slow. Don’t know what’s going on here.
Any idea how can I evaluate the real performance of the app ?
Many thanks.

“react-native”: “0.41.2”,
“react”: “15.4.2”,
“native-base”: “^2.0.10”,

(Andrew Goodale) #2

I’ve seen that as well. It’s because when you run with remote debugging, the JavaScript code is executed inside Chrome’s V8 engine. That is able to do various optimizations with JIT compiling. When running without debugging, JavaScript is executed by iOS’s JavaScriptCore, which cannot JIT-compile JavaScript. There are also differences in performance between the two engines. For example, I noticed that mutating Date objects is slower in JavaScriptCore than V8.

I recommend putting in some log statements and/or using react-addons-perf to analyze where you’re spending your time.

(John Amein) #3

I am finding the same issue. The Release version runs javascript on the device. I find the Release version works great as long as the debugger is connected via being on the same wifi network. The slow behavior appears like each user action, such as a touch, timing out waiting for the debugger, roughly 10 seconds. Then it executes.

(John Amein) #4

I ran the performance tools from Xcode and discovered memory blooming by 200Mb and then receding back after touch actions, . After reading this, I removed all console.log statements. Then everything worked perfectly. The on-phone app is now just as snappy as the simulator.