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.
-
1Test and measure. – user207421 May 28 '18 at 05:04
-
Check [this](https://stackoverflow.com/questions/3323074/android-difference-between-parcelable-and-serializable?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) – sneharc May 28 '18 at 05:05
-
Native Kotlin Serialization, I quote from the official GitHub page, "is still highly experimental". So it's nothing like an alternative to the bog-standard Java Serialization or Android's native Parcelable. – Marko Topolnik May 28 '18 at 06:44
3 Answers
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).

- 167,066
- 35
- 309
- 487
Yes, Serializable is exactly more simple than Parcelable but Parcelable is much more faster than Serializable. If your application not require maximize performance optimized, Serializable still fine.

- 104
- 4
-
2In Kotlin, implementing Parcelable is much easier, so the trade-off changes. – Alexey Romanov May 28 '18 at 06:59
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.
Whether you are using JAVA
or Kotlin
, the internal working of Serializable
and Parcelable
will still remain same. Hence, even for Kotlin its recommend using Parcelable for better and faster performance.
Hope it helps.

- 25,740
- 15
- 81
- 107