Optimizing Applications Performance

97b8897f620c6dc18f4ea6a53e0e0796?s=47 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.

97b8897f620c6dc18f4ea6a53e0e0796?s=128

Ekene Eze

November 18, 2017
Tweet

Transcript

  1. Optimizing Applications Performance ~ best practices Speakerdeck.com/kenny_io @kenny_io

  2. @kenny_io Peter Ekene Eze Android Developer @kenny_io Dzone, Dev.to, Medium

    Android Nigeria Com
  3. So.. WHY ?? Optimizing Applications Performance “Users Demand High Performance”

  4. Users Expects your app to Optimizing Applications Performance Interact Quickly

    Spare Battery Load Quickly
  5. 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
  6. Optimizing Applications Performance Users reactions and expressions

  7. Optimizing Applications Performance COOL… WELLDONE!!!! 1.

  8. Optimizing Applications Performance DUDE…. WTF !!!! 2.

  9. Optimizing Applications Performance Jeeeeezzz..! i can’t take this anymore 3.

  10. Optimizing Applications Performance Ok don’t worry, i know what to

    do 4.
  11. Optimizing Applications Performance

  12. 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
  13. 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
  14. Build Optimized Mobile Apps To Meet User Demands and Satisfy

    Expectations on a wide scale The Answer Optimizing Applications Performance
  15. But.. HOW ?? Optimizing Applications Performance

  16. Optimizing Applications Performance Battery Layout perf Response

  17. 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
  18. 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
  19. Optimizing Layout Performance Leverage On Doze Mode

  20. 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
  21. 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
  22. 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……
  23. Optimizing Layout Performance View Hierarchy ImageView TextView TextView

  24. Horizontal Linear Layout Optimizing Layout Performance View Hierarchy ImageView Vertical

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

    <Include…./> Improving hierarchy perf titlebar titlebar HELLO
  26. Optimizing Layout Performance  Lint  Layout Inspector Hierarchy Diagnosis

  27. Keeping Your App Responsive Optimizing Response Performance

  28. Optimizing Response Performance The worst thing that can happen to

    your app's responsiveness is an "Application Not Responding" (ANR) dialog.
  29. 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
  30. 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
  31. Optimizing Applications Performance Go to https://developer.android.com/training/articles/perf-anr.html https://developer.android.com/topic/performance/threads.html https://developer.android.com/training/monitoring-device- state/battery-monitoring.html#MonitorLevel https://developer.android.com/reference/android/app/AlarmMana

    ger.html References
  32. Optimizing Layout Performance THANK YOU