Android Jetpack Benchmark: JSON Parser Performance
Article Summary
Mootaz Ltaief from OLX Engineering put four popular Android JSON parsers head-to-head using Jetpack Benchmark. The results reveal a brutal tradeoff: the fastest parser costs you 1.1 MB of app size.
When OLX slashed their Android app from 23 MB to 11 MB, they discovered Jackson was consuming 1.1 MB alone. This sparked a systematic benchmark of Gson, Moshi, Jackson, and Kotlinx.Serialization using Google's new Benchmark library on a lower-end Huawei Y7 device representing their core userbase.
Key Takeaways
- Jackson wins on speed but adds 1.1 MB and 10k+ methods to your APK
- Kotlinx.Serialization runs nearly as fast with much smaller footprint
- Moshi is tiniest at 82 KB but slowest on complex JSON payloads
- Performance gaps widen dramatically on lower-end devices with complex responses
Critical Insight
For Android apps targeting emerging markets or size-conscious builds, Kotlinx.Serialization offers the best balance of speed and footprint, running close to Jackson's performance at a fraction of the size cost.