Saturday, December 17, 2011

Android Application Performance Improvement (using DDMS-Traceview/MAT tool): Part-1

The Application Performance improvement process is one of the real challenges in the mobile application development. Android provides various tools to analyze the performance of the application, like-DDMS, Traceview, Allocation Tracker. The memory analysis can be done through Eclipse Memory Analysis Tool which a very powerful tool. It provides various analysis, like-Histogram, Dominator Tree, Leak Suspects along with chart analysis.

This post covers the time analysis of an application, i.e. Stock Watch Application (which is one of my in-house developments) for an example, by using Traceview tool and the improvements observed in the application performance on post-optimization.

Traceview


Traceview is a graphical viewer for execution logs that you creates by using the Debug class to log tracing information in your code. Traceview can help you debug your application and profile its performance. It displays the log files data in two panels:
  • A timeline panel -- describes when each thread and method started and stopped
  • A profile panel -- provides a summary of what happened inside a method

Traceview Analysis on Pre-optimisation

Traceview helps us to find out the time spent in each method so that we could track the performance of each method we have written in the application.

1.       Start with Traceview profiling: Open Eclipse->DDMS->Devices(Tab), select the process of your application in the all the processes running on emulator/device. Now press ‘Start Method Profiling’ button as shown in below image.


2.       Application Navigation: Navigate to the application parts for which you want to create the profiling

3.       Stop Profiling: From the Devices Tab, select ‘Stop Method Profiling’ button as shown in below image. A profiling report will get generate automatically where you can start analysis.



As shown in the below image of Traceview report, the navigation time of these two activities is 51000 milliseconds*. The control was in the main Asynchronous thread for a large amount of time.

*since it is tested at android emulator; on device we might found the time difference.


Traceview Analysis on Post-optimisation

After optimizing the code, the navigation time has been reduced from 51000 milliseconds to 42000 milliseconds.


Performance Improvements
Improving application performance in terms of time and memory is one of the real challenges in mobile development. The android native tools like-DDMS/Traceview plays a significant role in improving the performance. Also these performance tests can be executed during the development life cycle.

Following are the performance improvements by using both the tools:

v  Using Traceview:
·         Navigation time reduced by 18%

·         Time spent by program control in Asyn Thread is lessened.

Hope now you can take advantage of Traceview tool to improve the performance of your application.

Note: The later parts of this post will cover the other tools analysis to improve android app performance. Keep an eye!! J

6 comments:

  1. I like your blog analyze.This is one of the good clarity post.Android is one of the well known mobile application.

    ReplyDelete
  2. but not a word of how optimization is done.. must say without that it is useless for me.. :S

    ReplyDelete
    Replies
    1. Hi ewoks,
      Thanks for your comment.
      well, Traceview tool is used to analyze time profiling of processes running in our application that which particular process/method is more time. To optimize the performance of any application we need to find out these kind of methods/codes snippets in our code and try optimizing only those snippets in the application.
      Now your question is how to optimize that code. thats a different story. being a developer you have to find out alternate/better solutions of what those methods are doing.

      So all in all. this tool will get us those methods in our application which are the main factor who are impacting our app performance.

      Delete
  3. This is an extraordinary designer review and anticipating future augmentations. Executing this in an example application has been much simpler than the past incarnation, such a variety of gratitude to the dev group. As others have said, if this permits us (devs) to adjust our applications (application information included) to Drive, it will permit us to make some incredible applications and overhaul existing ones.
    Android app developers // Mobile Application Development // Android Application Development

    ReplyDelete
  4. "Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.."!!
    ios app development services

    ReplyDelete