Android app to the challenge

Udi Cohen
Udi CohenSoftware Engineer at Any.DO
Android
App to the challenge


      Udi Cohen
We'll talk about..
●   Graphics:
       –   Over Draw
       –   Detect UI glitches
       –   Optimizing layouts with HierarchyViewer
●   Profiling with Traceview
●   Helping the GC with HPROF
●   Playing tough with StrictMode
●   Getting intimate with the OS using EventLog
●   Hardware Accelerate your app
●   Tips
whoami
Over Draw
●   Draw something on top of
     something else              4x
●   Rule – aim overdraw to 2x    3x
●   Could indicate a complex
                                 2x
     hierarchy
●   “Show GPU overdraws” on
      Developer options (4.2+)
                                 1x
Over Draw – Solutions
●   Remove default background
●   getWindow().setBackgroundDrawable(null)
●   <item name="android:windowBackground">@null
        </item>

●   Transparent regions in
      9patches
●   Use tools
●   Tracer for OpenGL
●   Hierarchy Viewer
Over Draw
Happens to the best of us
Tracer for OpenGL
●   Layout tree step by step
●   See redundant draw operations
●   Heavy
Dumpsys gfxinfo
●   Since Jelly Bean
●   Last 128 frames
●   Frame < 16ms
●   3 columns
       –   Draw
       –   Process   9
                     8
                     7
       –   Execute   6
                     5                                                                  Execute
                     4                                                                  Process
●                    3                                                                  Draw
                     2
                     1
                     0
                             5       13 21 29 37 45 53 61 69 77 85 93 101 109 117 125
                         1       9     17 25 33 41 49 57 65 73 81 89 97 105 113 121
Hierarchy Viewer
Traceview Profiling
●   Performance of each method
●   Graphical interface
●   Run from DDMS or code
Traceview Profiling
Traceview Profiling




Inclusive: Includes child functions

Exclusive: This function only
Traceview Profiling
Traceview Profiling
So...what's the problem here?
Helping out the GC
●   Allocation Tracker (DDMS)
●
Helping out the GC
●   Memory profiling → Dalvik HPROF file
    Use code or DDMS
●   Use hprof-conv to convert to standard
●   Use any Java HPROF analyzer
Helping out the GC
●   Eclipse MAT (Memory Analyzer Tool)
Helping out the GC
●   Histogram & Dominator tree
Tips - Bitmaps
●   InJustDecodeBounds – Load only
      properties
●   InBitmap – reuse other allocation
●   InSampleSize – good for preview
●   Resource folders
StrictMode
●   Problems Detector
●   Single thread or the entire VM
●   Show dialog, write to Log and more..
●   Usually used to detect slow operations on
     UI thread
●   Came with Gingerbread (2.3)
Log
●   EventLog
      –   Adb logcat -b events
      –   Framework level logs
      –   DB and system operations
Hardware Acceleration
●   android:hardwareAccelerated="true"
     or
     targetApi >= 14
●   Efficient drawing model
●   Compatibility issues
       –   Custom views
       –   Unsupported operations
Hardware Acceleration
●   Good for animations
●   View Layers
Tips
●   Always Measure
●   Lint
       –   Comes with the SDK
       –   Scan the project's for optimizations
       –   Great Eclipse/IntelliJ integration
●   ListView – Easy on the getView()
●   Alpha – Watch it...
●   Storage Read/Write
●   Direct access inside the class (!Get/Set)
●   SQLite indexes
@udinic
http://www.udinic.com
udi@udinic.com



              Thank you
1 of 25

Recommended

Powerlang: a Vehicle for Lively Implementing Programming Languages by
Powerlang: a Vehicle for Lively Implementing Programming LanguagesPowerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming LanguagesFAST
78 views11 slides
Powerlang: a Vehicle for Lively Implementing Programming Languages by
Powerlang: a Vehicle for Lively Implementing Programming LanguagesPowerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming LanguagesESUG
284 views9 slides
Alternative approach to native Kotlin by
Alternative approach to native KotlinAlternative approach to native Kotlin
Alternative approach to native KotlinAndrei Chernyshev
98 views6 slides
Zoomcharts @ DevClub.lv by
Zoomcharts @ DevClub.lvZoomcharts @ DevClub.lv
Zoomcharts @ DevClub.lvViesturs Zariņš
391 views34 slides
5 Tips and 4 and 1⁄2 Tricks for Porting GNOME Applications to Maemo Platform by
5 Tips and 4 and 1⁄2 Tricks for Porting GNOME Applications to Maemo Platform 5 Tips and 4 and 1⁄2 Tricks for Porting GNOME Applications to Maemo Platform
5 Tips and 4 and 1⁄2 Tricks for Porting GNOME Applications to Maemo Platform Eduardo Lima
392 views37 slides
Android preformance by
Android preformanceAndroid preformance
Android preformanceUdi Cohen
956 views16 slides

More Related Content

Similar to Android app to the challenge

Computer Graphics - Lecture 01 - 3D Programming I by
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I💻 Anton Gerdelan
585 views57 slides
Towards Continuous Deployment with Django by
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with DjangoRoger Barnes
18.3K views48 slides
Monitoring your VM's at Scale by
Monitoring your VM's at ScaleMonitoring your VM's at Scale
Monitoring your VM's at ScaleKris Buytaert
9.7K views36 slides
Inside Android's UI / ABS 2013 by
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Opersys inc.
1.1K views46 slides
The Accidental DBA by
The Accidental DBAThe Accidental DBA
The Accidental DBAPostgreSQL Experts, Inc.
1.5K views61 slides

Similar to Android app to the challenge(20)

Computer Graphics - Lecture 01 - 3D Programming I by 💻 Anton Gerdelan
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
Towards Continuous Deployment with Django by Roger Barnes
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
Roger Barnes18.3K views
Monitoring your VM's at Scale by Kris Buytaert
Monitoring your VM's at ScaleMonitoring your VM's at Scale
Monitoring your VM's at Scale
Kris Buytaert9.7K views
Inside Android's UI / ABS 2013 by Opersys inc.
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
Opersys inc.1.1K views
Leveraging Android's Linux Heritage at ELC-E 2011 by Opersys inc.
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.722 views
High performance graphics and computation - OpenGL ES and RenderScript by BlrDroid
High performance graphics and computation - OpenGL ES and RenderScript High performance graphics and computation - OpenGL ES and RenderScript
High performance graphics and computation - OpenGL ES and RenderScript
BlrDroid 1.9K views
Ceph Day Melbourne - Troubleshooting Ceph by Ceph Community
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Community 510 views
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide by Linaro
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
Linaro866 views
Inside Android's UI by Opersys inc.
Inside Android's UIInside Android's UI
Inside Android's UI
Opersys inc.7.6K views
Leveraging Android's Linux Heritage by Opersys inc.
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
Opersys inc.1.2K views
PHP Aberdeen Quick optimisation of PHP with Webgrind by Andy_Gaskell
PHP Aberdeen Quick optimisation of PHP with WebgrindPHP Aberdeen Quick optimisation of PHP with Webgrind
PHP Aberdeen Quick optimisation of PHP with Webgrind
Andy_Gaskell416 views
Creating a reasonable project boilerplate by Stanislav Petrov
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov104 views
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools by Xiaozhe Wang
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling ToolsTIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
Xiaozhe Wang11.4K views
Effective memory management by Yurii Kotov
Effective memory managementEffective memory management
Effective memory management
Yurii Kotov1.1K views
Analyzing Web App Performance using Chromium DevTool by Jincheol Jo
Analyzing Web App Performance using Chromium DevTool Analyzing Web App Performance using Chromium DevTool
Analyzing Web App Performance using Chromium DevTool
Jincheol Jo1.7K views

Recently uploaded

Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...BookNet Canada
43 views16 slides
Inawisdom IDP by
Inawisdom IDPInawisdom IDP
Inawisdom IDPPhilipBasford
17 views48 slides
Measurecamp Brussels - Synthetic data.pdf by
Measurecamp Brussels - Synthetic data.pdfMeasurecamp Brussels - Synthetic data.pdf
Measurecamp Brussels - Synthetic data.pdfHuman37
27 views14 slides
GDSC GLAU Info Session.pptx by
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptxgauriverrma4
15 views28 slides
Choosing the Right Flutter App Development Company by
Choosing the Right Flutter App Development CompanyChoosing the Right Flutter App Development Company
Choosing the Right Flutter App Development CompanyFicode Technologies
13 views9 slides
What is Authentication Active Directory_.pptx by
What is Authentication Active Directory_.pptxWhat is Authentication Active Directory_.pptx
What is Authentication Active Directory_.pptxHeenaMehta35
15 views7 slides

Recently uploaded(20)

Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by BookNet Canada
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
BookNet Canada43 views
Measurecamp Brussels - Synthetic data.pdf by Human37
Measurecamp Brussels - Synthetic data.pdfMeasurecamp Brussels - Synthetic data.pdf
Measurecamp Brussels - Synthetic data.pdf
Human37 27 views
GDSC GLAU Info Session.pptx by gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
What is Authentication Active Directory_.pptx by HeenaMehta35
What is Authentication Active Directory_.pptxWhat is Authentication Active Directory_.pptx
What is Authentication Active Directory_.pptx
HeenaMehta3515 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu474 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada46 views
Innovation & Entrepreneurship strategies in Dairy Industry by PervaizDar1
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy Industry
PervaizDar139 views
Mobile Core Solutions & Successful Cases.pdf by IPLOOK Networks
Mobile Core Solutions & Successful Cases.pdfMobile Core Solutions & Successful Cases.pdf
Mobile Core Solutions & Successful Cases.pdf
IPLOOK Networks16 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue209 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays37 views
This talk was not generated with ChatGPT: how AI is changing science by Elena Simperl
This talk was not generated with ChatGPT: how AI is changing scienceThis talk was not generated with ChatGPT: how AI is changing science
This talk was not generated with ChatGPT: how AI is changing science
Elena Simperl34 views
AI + Memoori = AIM by Memoori
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIM
Memoori15 views
The Coming AI Tsunami.pptx by johnhandby
The Coming AI Tsunami.pptxThe Coming AI Tsunami.pptx
The Coming AI Tsunami.pptx
johnhandby14 views
AIM102-S_Cognizant_CognizantCognitive by PhilipBasford
AIM102-S_Cognizant_CognizantCognitiveAIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitive
PhilipBasford23 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty66 views

Android app to the challenge

  • 1. Android App to the challenge Udi Cohen
  • 2. We'll talk about.. ● Graphics: – Over Draw – Detect UI glitches – Optimizing layouts with HierarchyViewer ● Profiling with Traceview ● Helping the GC with HPROF ● Playing tough with StrictMode ● Getting intimate with the OS using EventLog ● Hardware Accelerate your app ● Tips
  • 4. Over Draw ● Draw something on top of something else 4x ● Rule – aim overdraw to 2x 3x ● Could indicate a complex 2x hierarchy ● “Show GPU overdraws” on Developer options (4.2+) 1x
  • 5. Over Draw – Solutions ● Remove default background ● getWindow().setBackgroundDrawable(null) ● <item name="android:windowBackground">@null </item> ● Transparent regions in 9patches ● Use tools ● Tracer for OpenGL ● Hierarchy Viewer
  • 6. Over Draw Happens to the best of us
  • 7. Tracer for OpenGL ● Layout tree step by step ● See redundant draw operations ● Heavy
  • 8. Dumpsys gfxinfo ● Since Jelly Bean ● Last 128 frames ● Frame < 16ms ● 3 columns – Draw – Process 9 8 7 – Execute 6 5 Execute 4 Process ● 3 Draw 2 1 0 5 13 21 29 37 45 53 61 69 77 85 93 101 109 117 125 1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121
  • 10. Traceview Profiling ● Performance of each method ● Graphical interface ● Run from DDMS or code
  • 12. Traceview Profiling Inclusive: Includes child functions Exclusive: This function only
  • 15. Helping out the GC ● Allocation Tracker (DDMS) ●
  • 16. Helping out the GC ● Memory profiling → Dalvik HPROF file Use code or DDMS ● Use hprof-conv to convert to standard ● Use any Java HPROF analyzer
  • 17. Helping out the GC ● Eclipse MAT (Memory Analyzer Tool)
  • 18. Helping out the GC ● Histogram & Dominator tree
  • 19. Tips - Bitmaps ● InJustDecodeBounds – Load only properties ● InBitmap – reuse other allocation ● InSampleSize – good for preview ● Resource folders
  • 20. StrictMode ● Problems Detector ● Single thread or the entire VM ● Show dialog, write to Log and more.. ● Usually used to detect slow operations on UI thread ● Came with Gingerbread (2.3)
  • 21. Log ● EventLog – Adb logcat -b events – Framework level logs – DB and system operations
  • 22. Hardware Acceleration ● android:hardwareAccelerated="true" or targetApi >= 14 ● Efficient drawing model ● Compatibility issues – Custom views – Unsupported operations
  • 23. Hardware Acceleration ● Good for animations ● View Layers
  • 24. Tips ● Always Measure ● Lint – Comes with the SDK – Scan the project's for optimizations – Great Eclipse/IntelliJ integration ● ListView – Easy on the getView() ● Alpha – Watch it... ● Storage Read/Write ● Direct access inside the class (!Get/Set) ● SQLite indexes