SlideShare a Scribd company logo
Android High Performance
Enrique López Mañas
Google Developer Expert & IT Consultor
Ego Slide
• IT Consultor
• Google Developer Expert
• @eenriquelopez
Performance
"how well a person,
machine, etc. does a
piece of work or an
activity"
Cambridge
But what is high performance?
• Strategies to create efficient software
Layout
Energy and battery
Security
Multithreading Programming
patterns
Debugging techniques
Why is important?
• User Engagement
• Costs
• Maintenance
• Quality
3 Important Limits
0.1s 1s 10s
[Miller 1968; Card et al. 1991]:
What this means in Android?
ANR
ANR
• No response for input event in 5 seconds
• BroadCast receiver still executing after 10 seconds
How to avoid it?
Background operations? Show feedback!
How to avoid it?
Splash Screen?
How to avoid it?
Calculations? Worker thread!
How to avoid it?
Systrace! TraceView!
Debug
DDMS
Networking
Layouts
TV: 24fps(NTSC), 25fps(PAL)
New cam-coders / slow motion: 48fps+
Blur can occur!
Apps: 60fps!
every 16 ms!
Layouts
Layouts
Reusing layouts
Reusing layouts
Reusing layouts
ViewStub
ViewStub.inflate() View.setVisibility()
ViewStub
Hierarchy Viewer
Profile GPU Rendering
Profile GPU Rendering
• Blue: draw
• Purple: prepare
• Red: process
• Orange: execute
Memory
“the ability to
remember information,
experiences, and
people"
Cambridge
Memory - Enumerations
Memory - Enumerations
Memory - Enumerations
Memory - Enumerations
Memory - Enumerations @IntDef
Memory - Enumerations @IntDef
Memory - Enumerations Summary
• Unnecessary allocations
• AVOID USING THEM
• Change as much as possible with static final
integer values
Memory - Constants
Constants in the code should be static and final to take advantage
of memory savings and to avoid
initialization in Java compiler
Memory - Strings
Memory - Strings
Memory - Strings
Memory Leaks
“a memory leak is a type of
resource leak that occurs
when a computer program
incorrectly manages
memory allocations in such
a way that memory which
is no longer needed is not
released.” Wikipedia
Memory Leaks - static fields
Memory Leaks - static fields
Memory Leaks - non-static inner classes
Memory Leaks - WeakReference
Threading
“Threading is a method of
hair removal originating in
Asia.”
Wikipedia
Threading
“is the smallest sequence
of programmed instructions
that can be managed
independently by a
scheduler”
Wikipedia
Threading
• AsyncTask
• Loader
• Threads…
Know your war!
Threading - AsyncTask
Communicate Worker
Thread with UI
Does not need to
communicate UI? Does not
need to notify user? DOES
NOT NEED ASYNCTASK!
If the AsyncTask has all
parameters Void, you are
only implementing
doInBackground() and you
do not need an AsyncTask
Threading - AsyncTaskLoader
Use it to fetch data
Same features as
AsyncTask…
…plus the Activity life-cycle
independency and data
caching
Threading - AsyncTaskLoader
Threading - Services
• Not threads!
• Executed in UI Thread by default
• Never start a long running operation!
• Lifecycle
Threading - IntentService
• Particular implementation of a Service
• Execute sequential operations in background
• Don’t need to handle the lifecycle
Networking
“process of communication
between different terminal
nodes to exchange data”
Me
Networking - best practices
Latency Gauging
Networking - best practices
Batch connections
• Wait, collect and send
• (Analytics)
Networking - best practices
Pre-fetch
• Download as much as possible
• (specially if idle connection)
Networking - best practices
Queuing connections
Networking - best practices
Caching responses
Networking - best practices
Last modified
Networking - best practices
Exponential back-off
I want your feedback!
http://bit.ly/droidConGR
#dfist

More Related Content

PDF
Enrique Lopez Manas "Android High Performance"
PDF
Fragments anyone
PPTX
Data binding
PDF
Android Things Internals
PDF
Performance Oriented Design
PPTX
Android performance
PPTX
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
PDF
Understanding and Designing Ultra low latency systems | Low Latency | Ultra L...
Enrique Lopez Manas "Android High Performance"
Fragments anyone
Data binding
Android Things Internals
Performance Oriented Design
Android performance
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
Understanding and Designing Ultra low latency systems | Low Latency | Ultra L...

Similar to Secure Development with Android (Enrique Lopez Manas Technology Stream) (20)

PDF
Ask the expert - App performance on Series 40 phones
PDF
“Enabling Ultra-low Power Edge Inference and On-device Learning with Akida,” ...
PDF
There's no magic... until you talk about databases
PDF
Multithreading and Actors
PDF
Anton Boyko "The future of serverless computing"
PDF
Profiling tools and Android Performance patterns
PDF
Capacity Planning for fun & profit
PDF
John adams talk cloudy
PDF
Alto Desempenho com Java
PDF
Azure Functions - the evolution of microservices platform or marketing gibber...
PDF
Mentoring Session with Innovesia: Advance Robotics
PPTX
Predictive Maintenance - Portland Machine Learning Meetup
PPTX
IMAGE PROCESSING
PDF
Supercharged graph visualization for cyber security
PPTX
Stream Analytics
PDF
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
PDF
Faults inside System Software
PPTX
The von Neumann Memory Barrier and Computer Architectures for the 21st Century
PPTX
aca mod1.pptx
PDF
Anomaly Detection at Scale
Ask the expert - App performance on Series 40 phones
“Enabling Ultra-low Power Edge Inference and On-device Learning with Akida,” ...
There's no magic... until you talk about databases
Multithreading and Actors
Anton Boyko "The future of serverless computing"
Profiling tools and Android Performance patterns
Capacity Planning for fun & profit
John adams talk cloudy
Alto Desempenho com Java
Azure Functions - the evolution of microservices platform or marketing gibber...
Mentoring Session with Innovesia: Advance Robotics
Predictive Maintenance - Portland Machine Learning Meetup
IMAGE PROCESSING
Supercharged graph visualization for cyber security
Stream Analytics
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Faults inside System Software
The von Neumann Memory Barrier and Computer Architectures for the 21st Century
aca mod1.pptx
Anomaly Detection at Scale
Ad

More from IT Arena (20)

PDF
Shalini Agarwal, LinkedIn. Engineering excellence: marathon, not a sprint
PDF
Dave Karow, Split. Powering Progressive Delivery With Data
PDF
Ihar Mahaniok, Angel Investor. Hunting unicorns for early stage investments
PDF
Yuriy Zaremba, AXDRAFT. How to sell your startup
PDF
John Griffin, Ford Credit Europe. Normalising failure and making way for succ...
PDF
Vitaliy Diatlenko, Uklon. Transforming your business with machine learning. T...
PDF
Chris Cassarino, SoftServe. Stop Fixating on Fixing – Solving the global enga...
PDF
Michael Labate, Intellias. EDI in the DNA: Why Equity, Diversity and Inclusio...
PDF
Beth Anne Katz, Microsoft. How to Product Manage Your Mental Health
PDF
Sally Foote, GoCompare & Look After My Bills. Magic Goggles: the tools you ne...
PDF
Colleen Graneto, Airbnb. 3 steps to better product decision making
PDF
Vasyl Zadvornyy, Prozorro. The Future of Governance: Can a Script Replace the...
PDF
Godard Abel, G2. The SaaS Trust Crisis
PDF
Zeb Evans, ClickUp. From $0 to $20M ARR in 2 Years: Bootstrapping to Natural ...
PPTX
Namir Anani, ICTC. Economic Resiliency in The Face of Adversity
PDF
Mada Seghete, Branch. Mobile Growth Trends
PDF
Julia Petryk, MacPaw. Product PR: a how-to guide
PDF
Yaroslav Ravlinko, Intellias. You don’t need Kubernetes. You need to understa...
PDF
Yaroslav Novytskyy, Anton Vasylenko, N-iX. Migrating to the cloud: options an...
PDF
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow
Shalini Agarwal, LinkedIn. Engineering excellence: marathon, not a sprint
Dave Karow, Split. Powering Progressive Delivery With Data
Ihar Mahaniok, Angel Investor. Hunting unicorns for early stage investments
Yuriy Zaremba, AXDRAFT. How to sell your startup
John Griffin, Ford Credit Europe. Normalising failure and making way for succ...
Vitaliy Diatlenko, Uklon. Transforming your business with machine learning. T...
Chris Cassarino, SoftServe. Stop Fixating on Fixing – Solving the global enga...
Michael Labate, Intellias. EDI in the DNA: Why Equity, Diversity and Inclusio...
Beth Anne Katz, Microsoft. How to Product Manage Your Mental Health
Sally Foote, GoCompare & Look After My Bills. Magic Goggles: the tools you ne...
Colleen Graneto, Airbnb. 3 steps to better product decision making
Vasyl Zadvornyy, Prozorro. The Future of Governance: Can a Script Replace the...
Godard Abel, G2. The SaaS Trust Crisis
Zeb Evans, ClickUp. From $0 to $20M ARR in 2 Years: Bootstrapping to Natural ...
Namir Anani, ICTC. Economic Resiliency in The Face of Adversity
Mada Seghete, Branch. Mobile Growth Trends
Julia Petryk, MacPaw. Product PR: a how-to guide
Yaroslav Ravlinko, Intellias. You don’t need Kubernetes. You need to understa...
Yaroslav Novytskyy, Anton Vasylenko, N-iX. Migrating to the cloud: options an...
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Machine learning based COVID-19 study performance prediction
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Secure Development with Android (Enrique Lopez Manas Technology Stream)