Debugging - How to profile react native memory usage - ios

General question. I'm developing an app using React Native, and certain actions bring my app up to around 500MB of RAM, where it usually gets killed.
I've searched the web for good material on RN memory profiling but have found nothing. I've tried using Instruments, but it's output doesn't give me much insight as to what are my memory guzzling processes.
TL;DR: Do you have a good way of profiling memory usage in React Native?
P.S. currently focusing on iOS.
Thanks in advance!
Uri

If you shake the device you can bring up the debug menu and enable perf.
Additionally if you're on iOS, xcode comes with a set of performance tools. In spotlight, cmd + space, search for instruments, open it and select Activity Monitor.

Performance
App developer menu - toggle Show Perf Monitor

You can use Xcode and Android studio for this case.
On Xcode, you can check below screenshot.
Also for the Android Studio, you can open profiler on 'View->Tool Windows->Profiler'

Related

React native iOS performance stats

I recently started my main app for iOS with React Native. I turned on the performance monitor on Expo but I do not know what is a good stat for the app. I have uploaded the picture of the monitor and was wondering are these stats good or should I work more on optimizing my app?
Thank you for any help. and please feel free to suggest any other tools, techniques or anything else.
you can use react devtools to profile problematic parts of your app and determine what the bottlenecks are. https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html
more info about using react devtools with react-native in the readme: https://www.npmjs.com/package/react-devtools#usage-with-react-native

Do I need the source code of the app to get performance metrics using Instruments?

I am interested in evaluating performance to an external iOS app. Can I use instruments only with binaries?
Is also around non-apple tools to do this?
thanks,
You should be able to use Instruments with your device and attach it to any running process.
Launch the app yourself and then attach to it from the Attach to Process... command in the Target menu in the Instruments window

Mobile app logging stats tools - Swift

I am developing a mobile GPS tracking app and I would like to know if there are any classes available that output the mobile stats to a view? Memory, CPU etc. Similar to Hi-res-Stats in AS3.
I would like to see usage while the app is used however the only tool I know of is built in to xcode and it wouldn't really be feasible taking my mac with me.
Thanks

Check how much memory or CPU is being used per app, for all running apps

I'm trying to analyze how much memory, battery and cpu usage is taken by each app that is currently running on my iOS device. I don't mind if this can be done programmatically or otherwise. I have XCode up and running and I realize it can be used to check the CPU/memory of apps I install and run on my device.
Just to be clear, I do not want the total CPU/memory usage, but rather per app for all apps that are currently running.
Is this possible in iOS 8.1, in any way, without jailbreaking my device?
Edit: I just tried out Instruments in XCode and I realize to use it, you need to be testing an app. Is it possible to use Instruments to get this system info, without testing a new app? Can I get this info from the terminal for example? Thanks.

Why does wkwebview run slower in cordova compare to mobile safari?

I've built an app using famo.us which runs very nicely in the native ios 8 browser and also this app: https://itunes.apple.com/us/app/webview-wkwebview-uiwebview/id928647773?mt=8
The app in the link allows you to test the performance in both UIWebView and WKWebView.
I've noticed after profiling in instruments that my app uses about 30-40% more cpu in cordova than when running in the app above. I have tried using both UIWebView and the experimental WKWebView plugin from Telerik. I have even tried pointing cordova directly to a webserver with the contents of my app.
No matter what I strip out or try, my app runs considerably slower in cordova. If cordova and the app store app use the same webviews (presumably), why would the former consume so much more cpu?
Any insight into where the overhead is in cordova would be greatly appreciated.
Thanks!
We've found that adding a (almost hidden) UIToolbar to the cordova project (to the MainController.view) improves performance. Strange but true...

Resources