I have read everywhere that Java Serializable is much slower than Parcelable . Is it the same case for Kotlin Serializable? Or is Kotlin Serializable equally fast as Kotlin Parcelable? Using Serializable seems to much simpler and i wanted to know if in Kotlin its fine to use Serializable instead of Parcelable.
Kotlin standard library doesn't have its own definition of Serializable, if you have code using it you'll notice import java.io.Serializable. So it's exactly as fast.
There is @Serializable from kotlinx.serialization (thanks to Marko Topolnik for reminding me of it), but it works very differently and is not easier to use than @Parcelize (see below).
Using Serializable seems to much simpler
But here you have an advantage: in Kotlin it's just as easy, just use the @Parcelize annotation (see the design document as well).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With