Overdraw
Any jerks or lag or performance or slowness may antagonize a user from using the App. Overdraw might be one of the causes.
Overdraw is when a pixel on the screen drawn multiple times.
Represented in four stages, which are 1x, 2x, 3x, and 4x.
To Diagnose Overdraw, we can use developer options android and turn on the debug GPU overdraw.
Tutorial on turning on developer options and Debug GPU overdraw:
- Enable Developer options. Click on the Build Number multiple times.
Fig 1. Enable Developer Options**
- Enable Debug GPU Overdraw.
Memory Leaks
ANR – Application Not Responding
App in the foreground and is unresponsive, user will get Application Not Responding – ANR.
If not in foreground, then it’s silently stopped.
ANR Triggers
Usually when app can’t respond to user input on main thread or UI thread.
Preventing system from processing input events from users.
Examples:
- Blocking I/O operation. Such as network access
- Taking time building in-memory structure
- Computing something expensive in Main or UI Thread
Android will trigger ANR when:
- No responses to an input event – within 5 seconds
- BroadcastReceiver doesn’t finish executing within 10-20 seconds
BroadcastReceiver is the one that listens for events either on app or system
Prevention of ANR
Keep the main or UI thread unblocked:
- Don’t perform blocking or long-running applications
- Minimize any lock contention – accessing same resources at the same time
- Use threads strategically – worker threads
Usually 100-200ms is the threshold for slowness in an app
References
Slow Rendering
UI rendering is an act of generating a frame from your app and displaying it on the screen.
To Achieve 60fps - frames per second, each frames must be able to be renderd under 16ms
Identify Jank – Stuttering or unsmooth motion in app’s UI
Identifying jank can be difficult. Stated from Developer.Android there are 3 method for identifying jank:
- Visual inspection – fast
- Systrace – more detail, more data which also means more difficult to analyze
- Custom performance monitoring
Profile GPU Rendering also can be used to analyze GPU rendering and we can anlyze where is the bottleneck of the application
References