Tag Archives: performance

My Guide to Performance Tuning For Android and Java

This is my guide to tuning performance of Java programs. It covers both cpu time and object memory analysis. I have found that this works for Java programs and for many Android applications. In the latter case, it helps if your Android application is structured so you can turn a section of an application into a standalone test case. Since many applications have background tasks, often implemented as subclasses of AsyncTask, this is usually easy to do.

The tool I prefer to use is HPROF. It is a simple profiling tool that is available with the Java SDK. It provides a variety of tools so you can address common performance problems, like the following: (1) you are allocating too many objects, which leads to a slow app because of too much garbage collection; (2) you are allocating objects and not properly releasing them, leading to a memory leak; (3) your computations are taking too long.

The topics I cover in this article include: (a) Getting started with HPROF in Eclipse, (b) HPROF Results (cpu times, object allocation), (c) Performance tuning suggestions, and (d) Other Android performance tuning tools. Continue reading

Posted in Android, Java | Tagged , , | 2 Comments

Notes on Performance Tuning of Java

When you need to analyze performance of a running Java program, there is a simple profiling tool already built in to the Java runtime environment: HPROF It allows you to analyze both execution time and heap allocation. It’s really basic, but gets the job done — and it’s free and easy to use. Continue reading

Posted in Java | Tagged , , | Leave a comment