How Reddit used the R8 optimizer for high impact performance
Article Summary
Ben Weiss from Google shares how Reddit achieved 40% faster cold startup and boosted Play Store ratings in under 2 weeks. The secret? Finally enabling R8 optimizer's full potential.
Reddit partnered with Android Developer Relations to evaluate their app using the App Performance Score. They identified major optimization opportunities and enabled R8's complete feature set, leading to dramatic improvements across startup time, stability, and user satisfaction metrics visible in both Android Vitals and Play Store ratings.
Key Takeaways
- 40% faster cold startup, 30% fewer ANRs, 25% better frame rendering
- Staff Engineer Drew Heavner implemented full R8 optimization in under 2 weeks
- Macrobenchmarks confirmed 55% faster startup and 19% more frames rendered
- R8 combines tree shaking, method inlining, and resource shrinking
- App size reduced by 14% in production, over one-third in benchmarks
Reddit achieved massive performance gains and higher Play Store ratings by enabling R8's full optimization mode in a focused two-week effort.
About This Article
Reddit's app was slow to start up because JIT compilation happened on user devices during runtime, and dex files loaded inefficiently. This meant people had to wait longer before they could actually use the app.
Reddit used Baseline Profiles to shift JIT compilation from user devices to developer machines ahead of time. They also added Startup Profiles to optimize how dex files were packaged, letting the d8 dexer focus on the classes and methods that matter most.
Testing showed JIT compilation happened two-thirds less often and took one-third less time to complete. Users could start browsing 18% faster after launching the app.