Facebook for Android: Lessons Learned

13
Facebook on Android DroidCon London 2013

description

Talk given at the DroidCon London 2013 conference by Tyrone Nicholas, an engineer on Facebook's Android team.

Transcript of Facebook for Android: Lessons Learned

Page 1: Facebook for Android: Lessons Learned

Facebook on AndroidDroidCon London 2013

Page 2: Facebook for Android: Lessons Learned

2009 – Wrap the Web

2012 – Go Native fast

Why we sucked

Page 3: Facebook for Android: Lessons Learned

Since Jan 2013: Per user, per day:

Photos posted up 20%

Messages up 33%

Time spent up 25%

Photo uploads quadrupled

Why we still suck have problems

• 360 million users every month

• 200 million every day• Feature surpass desktop

web

Page 4: Facebook for Android: Lessons Learned

Emerging markets 40% of users still on Gingerbread or earlier 8 million users per day on Froyo 40% of users using old versions of the app

How can we not?

Page 5: Facebook for Android: Lessons Learned

Since January 2013: 20-30 new features per month Crashes per user down 30% APK size flat Data usage flat

What we’ve achieved

Page 6: Facebook for Android: Lessons Learned

Do’s

Page 7: Facebook for Android: Lessons Learned

Tradeoffs

Page 8: Facebook for Android: Lessons Learned

HTML5 doesn’t work New Zealand is your friend TechCrunch is not Java on Dalvik is different Beware server-side libraries like Guava Purgeable bitmaps don’t help much

Don’t

Page 9: Facebook for Android: Lessons Learned

Dalvik loads metadata about each method into a fixed 5 MB buffer

We filled it up (bug fixed in HC) We hacked into Dalvik’s memory space to

increase this size! Tested across dozens of devices

LinearAlloc

Page 10: Facebook for Android: Lessons Learned

4-line change removed some extra data from logging

Reduced start time for FB Messenger by 10% Ends up saving a year every day!

What four lines can do

Page 11: Facebook for Android: Lessons Learned

Use up mountains of memory Not garbage collected effectively GB and

earlier Leading cause of OutOfMemoryErrors Rotating, resizing etc, loses purgeability

Bitmaps

Page 12: Facebook for Android: Lessons Learned

Custom reference counting Custom purgeability Libjpeg-turbo

Bitmaps

Page 13: Facebook for Android: Lessons Learned

Tyrone Nicholas [email protected]

Questions?