SlideShare a Scribd company logo
Get off my thread!
Adventures in perceived performance
Ori Peleg
Software Engineer
DroidCon TLV, June, 2014
1 Our app is stuck
2 Background service
3 Jank hunters never sleep
4 Nonblocking frenzy
5 Conclusion
Agenda
Our app is stuck
Slow activity
▪  App was stuck
▪  ~5 seconds on older devices
Slow activity
▪  App was stuck
▪  ~5 seconds on older devices
▪  ANR :-(
▪  Computed items to display
Make it faster?
▪  The app was still stuck!
▪  Turns out we were Main Thread
bandits
▪  Any work done on the main
thread
▪  Prevents UI updates
▪  Prevents interaction (touch,
back button)
Make it seem faster!
▪  The app was still stuck!
▪  Turns out we were Main Thread
bandits
▪  Any work done on the main
thread
▪  Prevents UI updates
▪  Prevents interaction (touch,
back button)
▪  AsyncTask to the rescue!
Background service still slow
Complex logic in the background
▪  “Make it a service”
▪  The app is super-slow
▪  “Separate process”
▪  The app isn’t stuck, but…
▪  Multi-process adds a lot of
complexity
Back to a single process
▪  App takes 10 seconds to load
▪  ANR :-(
▪  Can the service affect the UI’s
performance?
▪  (yes)
▪  Many dependent initialization
steps
▪  AsyncTask?
Threads
▪  Many things can happen in
parallel
▪  Main thread stays free
▪  But we create a lot of threads
Thread pools (Executors)
▪  Reuse threads
▪  Grows as needed
Jank hunters never sleep
Jank hunters
▪  We must fight to keep the
main thread free!
▪  Every Activity Service callback
is called in the main thread!
▪  Computations – too slow
▪  Network access – too slow
▪  Disk I/O?
▪  Even that is too slow
▪  StrictMode FTW
SharedPreferences
▪  In-memory cache
▪  Fast enough for the main
thread
▪  But what about editing?
▪  .commit() flushes to disk (can
block)
▪  No guarantees (no fsync)
▪  .apply() is good
Common patterns
▪  Loading images
▪  Picasso, by Square
▪  UI isn’t ready
▪  Progress indicator
▪  Some of the UI isn’t ready
▪  Show later (progress / fade in)
▪  Background processing
▪  IntentService (instead of Service)
Common errors
▪  Activity/Fragment have died
while processing
▪  Cancel work in onStop/
onDestroy
▪  Check isDestroyed/isAdded
▪  Thread-sensitive code
▪  ThreadLocal
Nonblocking frenzy manageable?
High-Velocity News – the FAST news app
▪  Fetch headlines in topic
▪  Fetch stories before you tap
▪  Simplify Concurrency with
Futures™
Futures (Guava’s extensions)
Get news feed (blocking)
Get news feed (Future)
Get news stories (parsed)
Get top news story
Display the news story
Alternatives to the callback chain
▪  Futures.transform
▪  RxJava
Conclusion get off my thread!
Simple rules to follow
▪  Be aware what’s running on which thread
▪  Remember what’s slow
▪  Offload asynchronicity to libraries
▪  Test on typical (vs high-end) devices
▪  Threads/Executors/Futures FTW
Ori Peleg
orip@fb.com

More Related Content

What's hot

Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
DevOpsDays Tel Aviv
 
Mouse Logitech MX Anywhere 3
Mouse Logitech MX Anywhere 3Mouse Logitech MX Anywhere 3
Mouse Logitech MX Anywhere 3
Ivano Digital
 
In the hunt of 100% delivery rate with mobile push notifications
In the hunt of 100% delivery rate with mobile push notificationsIn the hunt of 100% delivery rate with mobile push notifications
In the hunt of 100% delivery rate with mobile push notifications
Jan Haložan
 
KazooCon 2014 - WebRTC
KazooCon 2014 - WebRTCKazooCon 2014 - WebRTC
KazooCon 2014 - WebRTC
2600Hz
 
Building micro-web-server
Building micro-web-serverBuilding micro-web-server
Building micro-web-server
Marcio Klepacz
 
DevOps: Getting Started with Puppet on Windows
DevOps: Getting Started with Puppet on WindowsDevOps: Getting Started with Puppet on Windows
DevOps: Getting Started with Puppet on Windows
Rob Reynolds
 
Expressjs from-zero-to-hero
Expressjs from-zero-to-heroExpressjs from-zero-to-hero
Expressjs from-zero-to-hero
Nicola Del Gobbo
 
A~Z Of Accelerator
A~Z Of AcceleratorA~Z Of Accelerator
A~Z Of Accelerator
shen liu
 
Yo pet - building a webRTC app in 20 mins
Yo pet - building a webRTC app in 20 minsYo pet - building a webRTC app in 20 mins
Yo pet - building a webRTC app in 20 mins
Tim Panton
 
Build your first Monster APP
Build your first Monster APPBuild your first Monster APP
Build your first Monster APP
2600Hz
 
iOS 7 URL Session & Motion FX APIs
iOS 7 URL Session & Motion FX APIsiOS 7 URL Session & Motion FX APIs
iOS 7 URL Session & Motion FX APIs
rsebbe
 
Moving from MAMP to Vagrant
Moving from MAMP to VagrantMoving from MAMP to Vagrant
Moving from MAMP to Vagrant
Jeremy Pry
 
Hacking Pebble on iOS
Hacking Pebble on iOSHacking Pebble on iOS
Hacking Pebble on iOS
AidenMontgomery
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
 
2600hz WebRTC Meetup at WeWork, San Francisco, CA
2600hz WebRTC Meetup at WeWork, San Francisco, CA2600hz WebRTC Meetup at WeWork, San Francisco, CA
2600hz WebRTC Meetup at WeWork, San Francisco, CA
2600Hz
 
Building Pistachio with Sencha Touch 2 (introductory)
Building Pistachio with Sencha Touch 2 (introductory)Building Pistachio with Sencha Touch 2 (introductory)
Building Pistachio with Sencha Touch 2 (introductory)
Luis Merino
 
Erlang: TL;DR
Erlang: TL;DRErlang: TL;DR
Erlang: TL;DR
vorn
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
capotej
 

What's hot (19)

Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
 
Mouse Logitech MX Anywhere 3
Mouse Logitech MX Anywhere 3Mouse Logitech MX Anywhere 3
Mouse Logitech MX Anywhere 3
 
Cloud tools
Cloud toolsCloud tools
Cloud tools
 
In the hunt of 100% delivery rate with mobile push notifications
In the hunt of 100% delivery rate with mobile push notificationsIn the hunt of 100% delivery rate with mobile push notifications
In the hunt of 100% delivery rate with mobile push notifications
 
KazooCon 2014 - WebRTC
KazooCon 2014 - WebRTCKazooCon 2014 - WebRTC
KazooCon 2014 - WebRTC
 
Building micro-web-server
Building micro-web-serverBuilding micro-web-server
Building micro-web-server
 
DevOps: Getting Started with Puppet on Windows
DevOps: Getting Started with Puppet on WindowsDevOps: Getting Started with Puppet on Windows
DevOps: Getting Started with Puppet on Windows
 
Expressjs from-zero-to-hero
Expressjs from-zero-to-heroExpressjs from-zero-to-hero
Expressjs from-zero-to-hero
 
A~Z Of Accelerator
A~Z Of AcceleratorA~Z Of Accelerator
A~Z Of Accelerator
 
Yo pet - building a webRTC app in 20 mins
Yo pet - building a webRTC app in 20 minsYo pet - building a webRTC app in 20 mins
Yo pet - building a webRTC app in 20 mins
 
Build your first Monster APP
Build your first Monster APPBuild your first Monster APP
Build your first Monster APP
 
iOS 7 URL Session & Motion FX APIs
iOS 7 URL Session & Motion FX APIsiOS 7 URL Session & Motion FX APIs
iOS 7 URL Session & Motion FX APIs
 
Moving from MAMP to Vagrant
Moving from MAMP to VagrantMoving from MAMP to Vagrant
Moving from MAMP to Vagrant
 
Hacking Pebble on iOS
Hacking Pebble on iOSHacking Pebble on iOS
Hacking Pebble on iOS
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
2600hz WebRTC Meetup at WeWork, San Francisco, CA
2600hz WebRTC Meetup at WeWork, San Francisco, CA2600hz WebRTC Meetup at WeWork, San Francisco, CA
2600hz WebRTC Meetup at WeWork, San Francisco, CA
 
Building Pistachio with Sencha Touch 2 (introductory)
Building Pistachio with Sencha Touch 2 (introductory)Building Pistachio with Sencha Touch 2 (introductory)
Building Pistachio with Sencha Touch 2 (introductory)
 
Erlang: TL;DR
Erlang: TL;DRErlang: TL;DR
Erlang: TL;DR
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
 

Viewers also liked

Death To Passwords
Death To PasswordsDeath To Passwords
Death To Passwords
DroidConTLV
 
Hello Camera Remote API
Hello Camera Remote APIHello Camera Remote API
Hello Camera Remote API
DroidConTLV
 
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
DroidConTLV
 
Analyze and optimize Android apps power consumption
Analyze and optimize Android apps power consumptionAnalyze and optimize Android apps power consumption
Analyze and optimize Android apps power consumption
DroidConTLV
 
Adding power to your Android distribution: Eight app stores or more in 30 min...
Adding power to your Android distribution: Eight app stores or more in 30 min...Adding power to your Android distribution: Eight app stores or more in 30 min...
Adding power to your Android distribution: Eight app stores or more in 30 min...
DroidConTLV
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
DroidConTLV
 
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
DroidConTLV
 
Know what (not) to build - Shem Magnezi, MyRoll
Know what (not) to build - Shem Magnezi, MyRollKnow what (not) to build - Shem Magnezi, MyRoll
Know what (not) to build - Shem Magnezi, MyRoll
DroidConTLV
 
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
DroidConTLV
 
Build an App with Blindfold - Britt Barak
Build an App with Blindfold - Britt Barak Build an App with Blindfold - Britt Barak
Build an App with Blindfold - Britt Barak
DroidConTLV
 
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
DroidConTLV
 
Knock knock! Who's there? Doze. - Yonatan Levin
Knock knock! Who's there? Doze. - Yonatan Levin Knock knock! Who's there? Doze. - Yonatan Levin
Knock knock! Who's there? Doze. - Yonatan Levin
DroidConTLV
 
Good Rules for Bad Apps - Shem magnezi
Good Rules for Bad Apps - Shem magnezi Good Rules for Bad Apps - Shem magnezi
Good Rules for Bad Apps - Shem magnezi
DroidConTLV
 
Optimize your delivery and quality with the right release methodology and too...
Optimize your delivery and quality with the right release methodology and too...Optimize your delivery and quality with the right release methodology and too...
Optimize your delivery and quality with the right release methodology and too...
DroidConTLV
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
DroidConTLV
 
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
DroidConTLV
 

Viewers also liked (16)

Death To Passwords
Death To PasswordsDeath To Passwords
Death To Passwords
 
Hello Camera Remote API
Hello Camera Remote APIHello Camera Remote API
Hello Camera Remote API
 
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
The Rounds Project: Growing from thousands to millions - Berry Ventura & Yoah...
 
Analyze and optimize Android apps power consumption
Analyze and optimize Android apps power consumptionAnalyze and optimize Android apps power consumption
Analyze and optimize Android apps power consumption
 
Adding power to your Android distribution: Eight app stores or more in 30 min...
Adding power to your Android distribution: Eight app stores or more in 30 min...Adding power to your Android distribution: Eight app stores or more in 30 min...
Adding power to your Android distribution: Eight app stores or more in 30 min...
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
Magneto - taking Android UI testing to the next level - Ran Ben Aharon, Every...
 
Know what (not) to build - Shem Magnezi, MyRoll
Know what (not) to build - Shem Magnezi, MyRollKnow what (not) to build - Shem Magnezi, MyRoll
Know what (not) to build - Shem Magnezi, MyRoll
 
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
SquiDB: a SQLite layer for Android - Jonathan Koren, Yahoo!
 
Build an App with Blindfold - Britt Barak
Build an App with Blindfold - Britt Barak Build an App with Blindfold - Britt Barak
Build an App with Blindfold - Britt Barak
 
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
 
Knock knock! Who's there? Doze. - Yonatan Levin
Knock knock! Who's there? Doze. - Yonatan Levin Knock knock! Who's there? Doze. - Yonatan Levin
Knock knock! Who's there? Doze. - Yonatan Levin
 
Good Rules for Bad Apps - Shem magnezi
Good Rules for Bad Apps - Shem magnezi Good Rules for Bad Apps - Shem magnezi
Good Rules for Bad Apps - Shem magnezi
 
Optimize your delivery and quality with the right release methodology and too...
Optimize your delivery and quality with the right release methodology and too...Optimize your delivery and quality with the right release methodology and too...
Optimize your delivery and quality with the right release methodology and too...
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
 

Similar to Get Off My Thread! - keep your UI super-responsive

DevOps: Building by feature with immutable infrastructure at Serv.sg
DevOps: Building by feature with immutable infrastructure at Serv.sgDevOps: Building by feature with immutable infrastructure at Serv.sg
DevOps: Building by feature with immutable infrastructure at Serv.sg
Nicolas Mas
 
stackconf 2020 | DevOps im Mittelstand by Falk Stern
stackconf 2020 | DevOps im Mittelstand by Falk Sternstackconf 2020 | DevOps im Mittelstand by Falk Stern
stackconf 2020 | DevOps im Mittelstand by Falk Stern
NETWAYS
 
Apps on Silicon
Apps on SiliconApps on Silicon
Apps on Silicon
Dr. Ernie Prabhakar
 
Python performance profiling
Python performance profilingPython performance profiling
Python performance profiling
Jon Haddad
 
Security in the face of adversity
Security in the face of adversitySecurity in the face of adversity
Security in the face of adversity
David Tibbs
 
Perconalive feb-2011-share
Perconalive feb-2011-sharePerconalive feb-2011-share
Perconalive feb-2011-share
mdcallag
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
Alex Cruise
 
Android development war stories
Android development war storiesAndroid development war stories
Android development war stories
Lope Emano
 
Simplicity vs. Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
Simplicity vs.Performance NSBCon NY by Jeffrey Palermo and Andrew SiemerSimplicity vs.Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
Simplicity vs. Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
Particular Software
 
New Shiny in the Metasploit Framework
New Shiny in the Metasploit FrameworkNew Shiny in the Metasploit Framework
New Shiny in the Metasploit Framework
egypt
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
Irawan Soetomo
 
Practical DMD Scripting
Practical DMD Scripting Practical DMD Scripting
Practical DMD Scripting
Zenoss
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
DevGAMM Conference
 
Everything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is WrongEverything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is Wrong
Tim Boudreau
 
JUST EAT: Embracing DevOps
JUST EAT: Embracing DevOpsJUST EAT: Embracing DevOps
JUST EAT: Embracing DevOps
Peter Mounce
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
Andrew Petukhov
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in Java
Lukas Steinbrecher
 
meetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesmeetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypes
Max Małecki
 
Monitoring of OpenNebula installations
Monitoring of OpenNebula installationsMonitoring of OpenNebula installations
Monitoring of OpenNebula installations
NETWAYS
 
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
OpenNebula Project
 

Similar to Get Off My Thread! - keep your UI super-responsive (20)

DevOps: Building by feature with immutable infrastructure at Serv.sg
DevOps: Building by feature with immutable infrastructure at Serv.sgDevOps: Building by feature with immutable infrastructure at Serv.sg
DevOps: Building by feature with immutable infrastructure at Serv.sg
 
stackconf 2020 | DevOps im Mittelstand by Falk Stern
stackconf 2020 | DevOps im Mittelstand by Falk Sternstackconf 2020 | DevOps im Mittelstand by Falk Stern
stackconf 2020 | DevOps im Mittelstand by Falk Stern
 
Apps on Silicon
Apps on SiliconApps on Silicon
Apps on Silicon
 
Python performance profiling
Python performance profilingPython performance profiling
Python performance profiling
 
Security in the face of adversity
Security in the face of adversitySecurity in the face of adversity
Security in the face of adversity
 
Perconalive feb-2011-share
Perconalive feb-2011-sharePerconalive feb-2011-share
Perconalive feb-2011-share
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
 
Android development war stories
Android development war storiesAndroid development war stories
Android development war stories
 
Simplicity vs. Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
Simplicity vs.Performance NSBCon NY by Jeffrey Palermo and Andrew SiemerSimplicity vs.Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
Simplicity vs. Performance NSBCon NY by Jeffrey Palermo and Andrew Siemer
 
New Shiny in the Metasploit Framework
New Shiny in the Metasploit FrameworkNew Shiny in the Metasploit Framework
New Shiny in the Metasploit Framework
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
 
Practical DMD Scripting
Practical DMD Scripting Practical DMD Scripting
Practical DMD Scripting
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
 
Everything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is WrongEverything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is Wrong
 
JUST EAT: Embracing DevOps
JUST EAT: Embracing DevOpsJUST EAT: Embracing DevOps
JUST EAT: Embracing DevOps
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in Java
 
meetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesmeetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypes
 
Monitoring of OpenNebula installations
Monitoring of OpenNebula installationsMonitoring of OpenNebula installations
Monitoring of OpenNebula installations
 
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
OpenNebulaConf 2013 - Monitoring of OpenNebula installations by Florian Heigl
 

More from DroidConTLV

Mobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, NikeMobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, Nike
DroidConTLV
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra Technologies
DroidConTLV
 
No more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola SolutionsNo more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola Solutions
DroidConTLV
 
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.comMobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
DroidConTLV
 
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellLiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
DroidConTLV
 
MVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, LightricksMVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, Lightricks
DroidConTLV
 
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
DroidConTLV
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice Ninja
DroidConTLV
 
New Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy ZukanovNew Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy Zukanov
DroidConTLV
 
Designing a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, GettDesigning a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, Gett
DroidConTLV
 
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, PepperThe Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
DroidConTLV
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
DroidConTLV
 
Flutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, TikalFlutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, Tikal
DroidConTLV
 
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bisReactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
DroidConTLV
 
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevelFun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
DroidConTLV
 
DroidconTLV 2019
DroidconTLV 2019DroidconTLV 2019
DroidconTLV 2019
DroidConTLV
 
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, MondayOk google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
DroidConTLV
 
Introduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, WixIntroduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, Wix
DroidConTLV
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
DroidConTLV
 
Educating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz TamirEducating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz Tamir
DroidConTLV
 

More from DroidConTLV (20)

Mobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, NikeMobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, Nike
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra Technologies
 
No more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola SolutionsNo more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola Solutions
 
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.comMobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
 
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellLiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
 
MVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, LightricksMVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, Lightricks
 
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice Ninja
 
New Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy ZukanovNew Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy Zukanov
 
Designing a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, GettDesigning a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, Gett
 
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, PepperThe Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
 
Flutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, TikalFlutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, Tikal
 
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bisReactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
 
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevelFun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
 
DroidconTLV 2019
DroidconTLV 2019DroidconTLV 2019
DroidconTLV 2019
 
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, MondayOk google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
 
Introduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, WixIntroduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, Wix
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
 
Educating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz TamirEducating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz Tamir
 

Recently uploaded

By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 

Recently uploaded (20)

By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 

Get Off My Thread! - keep your UI super-responsive

  • 1. Get off my thread! Adventures in perceived performance Ori Peleg Software Engineer DroidCon TLV, June, 2014
  • 2. 1 Our app is stuck 2 Background service 3 Jank hunters never sleep 4 Nonblocking frenzy 5 Conclusion Agenda
  • 3. Our app is stuck
  • 4. Slow activity ▪  App was stuck ▪  ~5 seconds on older devices
  • 5. Slow activity ▪  App was stuck ▪  ~5 seconds on older devices ▪  ANR :-( ▪  Computed items to display
  • 6. Make it faster? ▪  The app was still stuck! ▪  Turns out we were Main Thread bandits ▪  Any work done on the main thread ▪  Prevents UI updates ▪  Prevents interaction (touch, back button)
  • 7. Make it seem faster! ▪  The app was still stuck! ▪  Turns out we were Main Thread bandits ▪  Any work done on the main thread ▪  Prevents UI updates ▪  Prevents interaction (touch, back button) ▪  AsyncTask to the rescue!
  • 9. Complex logic in the background ▪  “Make it a service” ▪  The app is super-slow ▪  “Separate process” ▪  The app isn’t stuck, but… ▪  Multi-process adds a lot of complexity
  • 10. Back to a single process ▪  App takes 10 seconds to load ▪  ANR :-( ▪  Can the service affect the UI’s performance? ▪  (yes) ▪  Many dependent initialization steps ▪  AsyncTask?
  • 11. Threads ▪  Many things can happen in parallel ▪  Main thread stays free ▪  But we create a lot of threads
  • 12. Thread pools (Executors) ▪  Reuse threads ▪  Grows as needed
  • 14. Jank hunters ▪  We must fight to keep the main thread free! ▪  Every Activity Service callback is called in the main thread! ▪  Computations – too slow ▪  Network access – too slow ▪  Disk I/O? ▪  Even that is too slow ▪  StrictMode FTW
  • 15. SharedPreferences ▪  In-memory cache ▪  Fast enough for the main thread ▪  But what about editing? ▪  .commit() flushes to disk (can block) ▪  No guarantees (no fsync) ▪  .apply() is good
  • 16. Common patterns ▪  Loading images ▪  Picasso, by Square ▪  UI isn’t ready ▪  Progress indicator ▪  Some of the UI isn’t ready ▪  Show later (progress / fade in) ▪  Background processing ▪  IntentService (instead of Service)
  • 17. Common errors ▪  Activity/Fragment have died while processing ▪  Cancel work in onStop/ onDestroy ▪  Check isDestroyed/isAdded ▪  Thread-sensitive code ▪  ThreadLocal
  • 19. High-Velocity News – the FAST news app ▪  Fetch headlines in topic ▪  Fetch stories before you tap ▪  Simplify Concurrency with Futures™
  • 21. Get news feed (blocking)
  • 22. Get news feed (Future)
  • 23. Get news stories (parsed)
  • 24. Get top news story
  • 26. Alternatives to the callback chain ▪  Futures.transform ▪  RxJava
  • 27. Conclusion get off my thread!
  • 28. Simple rules to follow ▪  Be aware what’s running on which thread ▪  Remember what’s slow ▪  Offload asynchronicity to libraries ▪  Test on typical (vs high-end) devices ▪  Threads/Executors/Futures FTW