Kotlinx.serialization internal logic


Could you please help, how the kotlinx.serialization works (for example with Json)?

Am I right that plugin generates the serializer/deserializer pairs in compile time, so there aren’t any reflection or something in runtime?
Am I right that this library has also api to reuse buffers, so it can do serialization/deserialization logic with stream-like approach in ktor?
Am I right, that we can expect the better performance of kotlinx.serialization than Jackson?

Yes, the serializer are generated in compile time. There are some reflection-based features like serializer inference, but they are optional.

Currently no, there is not integration between serialization and io, but as far as I know it is planned.

In theory, yes. I did not make any measurements, but I heard that it is already on par with Jackson, and could be better, not by far though, since the main bottleneck is not parsing.

1 Like

Awesome, thank you!