Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Optimizing Applications Performance

Ekene Eze
November 18, 2017

Optimizing Applications Performance

This is the slides for my presentation (optimizinzg application performance) at DevFestSW event held in ibadan 2017. it is focused on Battery, Layout and Responsive optimizations.

Ekene Eze

November 18, 2017
Tweet

More Decks by Ekene Eze

Other Decks in Technology

Transcript

  1. Users Statistics Optimizing Applications Performance • 0% Users • 49%Users

    • 30%Users • Every 1 in 5 Users Expects mobile page to load instantly Expects mobile page to load in 2+sec Expects App load in 20+ sec Expects mobile page to load in 3+ sec
  2. If the app fails to deliver the right experience or

    fails to perform satisfactorily  It hurts the brand image  The users start uninstalling the app  Ratings start dropping  Potential sales and ad revenues disappear  And finally…….. Developer gets FIRED!! Consequences Optimizing Applications Performance
  3. How can developers and enterprises implement performance best practices to

    keep their products afloat in such a tasking mobile era?? The Big Question Optimizing Applications Performance
  4. Build Optimized Mobile Apps To Meet User Demands and Satisfy

    Expectations on a wide scale The Answer Optimizing Applications Performance
  5. Optimizing Layout Performance ABM broadcasts an action whenever the device

    is connected or disconnected to a power source Consider battery level and state while scheduling heavy tasks
  6. Optimizing Layout Performance Doze reduces battery consumption by deferring background

    CPU and network activity for apps when the device is unused for some period of time Leverage On Doze Mode
  7. Optimizing Layout Performance To adapt your app to Doze, create

    an instance of your AlarmManager and call these methods on it . setAndAllowWhileIdle() and setExactAndAllowWhileIdle(), Adapt App to Doze
  8. Optimizing Layout Performance The way you manage the hierarchy of

    your View objects can have a substantial impact on your app’s performance View Hierarchy
  9. Optimizing Layout Performance Measure stage - the system determines the

    sizes and boundaries of View objects. Layout stage - Uses this data, also taking object weights into account, to appropriately position the relevant items in your view hierarchy It determines where on the screen to position the View objects. Rendering flow……
  10. Horizontal Linear Layout Optimizing Layout Performance View Hierarchy ImageView Vertical

    Linear Layout TextView TextView Vertical Linear ImageView TextView TextView
  11. Optimizing Layout Performance  Removing redundant nested layouts  Adopting

    <Include…./> Improving hierarchy perf titlebar titlebar HELLO
  12. Optimizing Response Performance The worst thing that can happen to

    your app's responsiveness is an "Application Not Responding" (ANR) dialog.
  13. Optimizing Response Performance Generally, the system displays an ANR dialog

    if an application cannot  respond to user input event (such as key press or screen touch events) within 5 seconds.  A BroadcastReciever hasn't finished executing within 10 seconds. Causes
  14. Optimizing Response Performance Activities running on the UI thread should

    do as little work as possible. Network or database operations should be done on a different thread (worker thread) or via asynchronous requests. Computational calculations like resizing bitmaps, should be done in the worker thread. Avoiding ANR Dialog