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

CodeFest 2019. Дмитрий Виноградов (Axel Springer) — Android. Производительность в Android-приложениях

16b6c87229eaf58768d25ed7b2bbbf52?s=47 CodeFest
April 06, 2019

CodeFest 2019. Дмитрий Виноградов (Axel Springer) — Android. Производительность в Android-приложениях

Я расскажу об инструментах, которые помогут вам повысить производительность ваших Android-приложений. Поговорим о памяти, CPU, сетевых запросах, энергопотреблении, размере APK и скорости UI.

16b6c87229eaf58768d25ed7b2bbbf52?s=128

CodeFest

April 06, 2019
Tweet

Transcript

  1. Performance Dmitry Vinogradov Android developer Axel Springer

  2. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  3. Performance is important • Happy User • Google Play Reviews

    • Google Play Search and Recommendation
  4. The Performance Lifecycle Gather Insight Action

  5. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  6. Menu: View -> Tool Windows -> Profiler

  7. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  8. None
  9. Trace recording

  10. Call Chart

  11. Flame Chart

  12. Top Down

  13. Bottom Up

  14. Recording Configurations 1. Sample Java Methods 2. Trace Java Methods

    3. Sample C/C++ Functions 4. Trace System Calls
  15. 1. Sample Java Methods

  16. 2. Trace Java Methods

  17. 4. Trace System Calls

  18. Trace Recording Options

  19. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  20. Memory Profiler

  21. Memory Allocation

  22. Memory Dump. dump button

  23. Memory Dump. Details

  24. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  25. None
  26. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  27. None
  28. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  29. Frame 60 FPS 16 ms = 1 / 60

  30. GPU Rendering

  31. GPU Overdraw

  32. None
  33. None
  34. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  35. Classes

  36. Proguard mappings mappings.txt usage.txt seeds.txt

  37. Compare

  38. • Performance • Android Studio Profiler • CPU • Memory

    • Network • Energy • GPU • APK Analyzer • Tips
  39. UI • Flat view heirarchy • ViewStub • <include>, <merge>

    • DiffUtil, notifyItem* • Avoid excess backgrounds
  40. Memory • Avoid creating unnecessary objects (iteration, onDraw, onBindViewHolder) •

    Avoid memory leaks • SparseArray • ComponentCallbacks2
  41. Network and Energy • Push (FCM) • Cache • Different

    picture quality or resolution • WebP or compressed PNG and JPEG • WiFi and Charger if can wait • Network batching
  42. APK size • Remove unused code (minifyEnabled) and resources (shrinkResources)

    • Vector graphic and nine-patch • Multiple APKs or App Bundle

  43. @start_android Dmitry Vinogradov Android developer Axel Springer Вопросы? startandroidpage www.startandroid.ru

    contact@startandroid.ru