3. Why?
25% of people leave a web page if it takes more than 4
seconds to load
4. why?
● Amazon: +100ms = -1% sales
● Google: going from 0.4 seconds to 0.9 seconds loading
a page causes a 20% decrease of benefits
● I don't have data about smartphones, but IMHO is even
worse
6. The concept
Classic case:
1. Download some data
2. Parse
3. Download more data (images, audios, ...)
4. Load it on memory
5. Show it on screen
7. Don't be a Java Hero
It seems to me that Java is designed to make it
difficult for programmers to write bad code,
while Python is designed to make it easy to
write good code.” — Magnus Lycka, Aug. 18,
2005
8. How?
● Compile always with the latest SDK (hardware accel, ...)
● Splash-screens are evil
● Don't do work on UI Thread
● Don't block the UI (ProgressDialogs...)
● Efficient GetViews
● Don't download same data 2 times
● Fight for the 60fps
20. $ adb shell procrank
Keep the app in memory (Analyze)
21. Other tools to analyze memory usage
● adb shell dumpsys meminfo
● Heap dump
○ capture it with DDMS
○ +HeapDumpOnOutOfMemoryError
● MAT (Memory Analyzer Tool)
○ analyzes your heap dump
○ hprof-conv package.hprof package-converted.hprof
○ It has a stand-alone version if you don't want to use Eclipse
25. Profile GPU Rendering
● profile last frames rendered
● You need to enable it on device (dev.options)
● you need <16ms per frame to get 60fps
● ddms -> System Information -> Frame render time
27. GPU Overdraw
● As a general recommendation
we can paint every pixel a max
of 3 times
● 9-patch for backgrounds
● lint can warn you about layouts
with possible overdraw
29. ● PerfMon (memory, cpu, network on a floating window)
● Usage Timelines (cpu, memory)
Other tools
30. ● Save a long with start time on Application and show a
diff with current time on a toast when you are end
"printing" screen
● Send through analytics performance data
● You can do it on all parts of your app
Detect regressions