Search code examples
iphoneandroidmobileenergyenergysmart

What kind of bugs have you fixed due to energy inefficiency issues when you develop mobile apps


For those who write applications for mobile phones, what kind of bugs/problems have you fixed in order to improve energy efficiency, and how much the fix improves?

A follow-up question: is energy efficiency considered as important as features and avoiding functionality bugs when you write mobile apps?


Solution

  • To answer the follow-up question first, very few customers notice any difference in energy efficiency or battery life from using a particular app. This is almost never mentioned in the App store reviews. I write power efficient code mostly because I don't want to run down my own device's batteries while testing and using my apps.

    Some suggestions for iPhone apps:

    1. Write your app so that it runs well on the slowest device (iPhone 2G or 3G) with the slowest OS (4.x on a 3G). Then it can mostly be idle on the much faster current devices.

    2. In graphics routines, try not to redraw anything already drawn. Use a small CALayer or sub view for localized graphics updates/changes.

    3. Use async methods as much as possible so that your app isn't even running on the CPU most of the time.

    4. Use plain C data structures (instead of Foundation objects) and pack them so that your app's working set can stay completely resident in the very limited ARM CPU data cache, if possible.

    5. Don't do networking any more than necessary. Do the largest data transfers possible at one time so that the radios can turn off longer between your app's network use, instead of lots of continuous small transfers.