Profiling Phonegap Apps

I have a Phonegap app that is using AngularJS/ionic Framework. I need to profile my app to find bottlenecks in my code in order to make it faster. Any idea how i can do that? Both for Android and iOS?

** this is an answer ** Starting Android 4, I can use remote debugging to inspect and profile Cordova Apps on Android. https://developer.chrome.com/devtools/docs/remote-debugging

This method has an advantage over using XDK - that it is using Android Native Browser. XDK uses Crosswalk - which is an optimized browser - results would be less accurate. Note that Crosswalk can be bundled with Cordova Apps but would increase app size dramatically - image Chrome is bundled with your app.

I would like to recommend using Intel(r) XDK, which allows to profile apps on real Android devices.

You need to choose the "Profile" tab in XDK and follow to the guide on the left of the page.

Currently XDK includes the CPU profiler which collects statistical call graph (aka stack sampling). This is an extension of CDT profiler. In addition to the call tree annotated by the time metrics, XDK profiler annotates the lines in your JavaScript code by the time information which allows analyze the internals of the functions in opposite to CDT which has only summary info for the functions. Here is a description of the feature with pics: https://software.intel.com/en-us/html5/xdkdocs#496099

XDK can be downloaded from the http://xdk-software.intel.com/. It supports development of the Cordova based apps. For this purposes, you need to create new project under XDK and import your sources to it. Check if your app works in the emulator tab and then go to the Debug/Profile tabs which allow to debug/profile apps on the real devices.

Starting Android 4, I can use remote debugging to inspect and profile Cordova Apps on Android. https://developer.chrome.com/devtools/docs/remote-debugging

This method has an advantage over using XDK - that it is using Android Native Browser. XDK uses Crosswalk - which is an optimized browser - results would be less accurate. Note that Crosswalk can be bundled with Cordova Apps but would increase app size dramatically - image Chrome is bundled with your app.