tags:

views:

77

answers:

2

Hi stackoverflow,
I am just starting out programming on Android.

What is the most computationally expensive Java constructs to avoid when programming an Android App?

Of cause every algorithm costs instructions, but what about use of Method calls, Object references, Interfaces, Collections and such? What do I need to avoid, and what is "cheap" when I'm programming for speed?

+1  A: 

You can find official guidelines here: http://developer.android.com/guide/practices/design/performance.html

You should also read http://developer.android.com/guide/practices/design/responsiveness.html and http://developer.android.com/guide/practices/design/seamlessness.html

There are some specific GUI optimizations (like ViewHolder pattern for ListAdapters) but start writing your app first, then fix things which are too slow. And remember: do not guess, use included profiler (tool TraceView and Debug class) to find out what exactly needs to be improved.

tomash
A: 

1) Write clean code. Poor code will hurt performance more than any micro optimization.

2) Understand Big Oh runtime, and make intelligent use of data structures.

bwawok