kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Streaming performance: kotlinx-io & Okio integrations

Open qwwdfsad opened this issue 1 year ago • 0 comments

See https://github.com/Kotlin/kotlinx.serialization/pull/2742 for the benchmarks.

Currently, decoding from the buffered source using kotlinx-serialization is unreasonably slow compared to Moshi.

One of the reasons is that we do not leverage select API that potentially requires https://github.com/Kotlin/kotlinx.serialization/issues/2240 to be implemented first.

But even with this API out of the equation, we still have a single bottle-neck -- byte-by-byte codepoint reading (see the profile attached), and that definitely can be more straightforward and efficient (e.g. using raw access to the underlying segments).

image

qwwdfsad avatar Jul 11 '24 12:07 qwwdfsad