saving a century a day: how the fresco library works
TRANSCRIPT
Source: run_comparison script, Moto G, KitKat. Results will vary with different devices, images, and network conditions.
Images are big, devices are small
Samsung Galaxy Tab 2
• 800 x 1280 pixels
• 4 bytes per pixel
• = 3.9 MB
• 1 GB RAM
• but only 48 MB heap!
Android heaps
Java
▪ JDK
▪ Limited
▪ Slow
▪ Safe
Ashmem
▪ Certain system
calls
▪ Unlimited, fast
▪ Safe (sort of)
▪ Use for BMP
Native
▪ NDK
▪ Unlimited
▪ Fast
▪ Unsafe
▪ Use for JPEG
Ashmem
Need memory?
Look for unpinned memory
Free and reallocate
▪ allocate
▪ free (indirect)
▪ pin
▪ unpin
DraweeView
Show placeholder
image
Show actual image
Fade-inanimation
Scale
Round
Scale
Round
Show failureimage
Round
Scale
Load from image
pipeline
Worked?
Last scan?
No
Yes
No
Updateprogres
s bar
Tap to
Retry