Is there are reason to prefer one or the other of ...
# serialization
s
Is there are reason to prefer one or the other of
Json.decodeFromString(file.readText())
vs.
file.outputStream().use { Json.decodeFromStream(it) }
?
e
given what kotlinx.serialization has been optimized for, I would expect the first to perform better. you can do your own benchmarking
s
Ah, interesting, thanks for that pointer!
However, from skimming over the issue it seems to have been addressed with version 1.5.0, so there is no performance difference anymore?
e
run your own benchmarks. I'm pretty sure it's still slower than Moshi whose bytes-to-UTF-8 path has been much more used and optimized
s
I'm not really interested in a comparison to Moshi, but in a KxS string vs stream API comparison. Do you have any pointers to benchmarks for that?
c
Do you have any pointers to benchmarks for that?
https://github.com/Kotlin/kotlinx-benchmark If you do write your own microbenchmark though, I highly recommend posting it here, because it's notoriously easy to write them wrong, so you'll want it to be reviewed by other people
s
Thanks, but I'll most probably not go into the rabbit hole of writing my own benchmark 😉 I was more looking for a "serious" source to refer to.