What is the general opinion on using kotlinx.seria...
# android
t
What is the general opinion on using kotlinx.serialization on android in terms of size and methods count? Gson just does not do well with kotlin nullability.
And are there places where kotlin serialization is lacking compared to gson and moshi based on experience?
g
iiric, no streams support for x-serialization yet and it's slightly slower. But overall positive experience
t
Benchmarks show it is faster though, when last did you use it @ghedeon
j
Gson is long since abandonware. Any comparison should be against Moshi or Jackson.
t
Thanks for the hint Jake.
c
Unless you’re supporting really old versions of Android, you probably don’t need to worry about method count anymore, as Multidex is enabled by default since SDK 21. Total APK size is still something to keep an eye on, but there may be more important metrics, like runtime performance, and features. And kotlinx.serialization has pretty good runtime performance: faster than GSON, and slightly slower than Moshi. Feature-wise, kotlinx.serialization is newer and lighter-weight, but still does all I have needed from it. Personally, I prefer kotlinx.serialization mainly because of its multiplatform capabilities
👍 1
g
@tjohnn using it daily but I'm happy with the experience enough, not to be bothered by the benchmarks. From what I remember from the recent kotlinconf it's not exactly faster. At the moment it's okay... which is promising, considering optimization wasn't a priority yet. It's good, go for it.
t
Great explanations, thanks all.