Search code examples
cordovatitaniumappceleratorbenchmarking

Benchmarking Cordova vs Titanium app


Context: At our university a Javascript library for mobile peer-to-peer programming has been developed. Originally, it used Titanium in order to be cross platform. However, if the programmer wants to use our library he needs to use Titanium. Hence, my job was to make it independent of the framework, and adding support for Cordova. Now people can use our library in both, Titanium and Cordova.

I developed an application which uses the library, once in Titanium and once in Cordova. As a last step, we want to compare both versions, using some benchmarks.

We had in mind to compare :

  • CPU usage
  • Memory usage
  • Communication speed
  • UI responsiveness (if possible?)

For the communication speed between two peers, I had in mind to mark each message with a timestamp at the moment of sending and receiving. Then send a big amount of messages and compute the average.

For CPU and memory usage, i had a look in the Titanium and Cordova docs. In Titanium i found Titanium.Platform.availableMemory. However, i still need to find how i can acces the total memory such that i can monitor the memory usage by doing Total Memory - Titanium.Platform.availableMemory and again compute an average. Furthermore, i need a way to do the same in Cordova.

I was not able to find a way to access CPU usage of the device. And I am wondering how i could monitor UI responsiveness.

For Cordova, i found an interesting article on automating performance audits.


Solution

  • You will never get 100% reliable data by looking at the API's of both platforms. You will need to use the native inspectors.

    For example, xCode has pretty good inspectors build in to monitor CPU and memory usage for example. Android has something similar too.

    If you "build" for device with Titanium (where I have experience with) it will generate an xCode project for you. This one can be opened by Xcode, and from there you can build it again for device and use the monitoring tools. Cordova projects will do something similar I guess. Not sure how those compile.