Joaco
08/07/2022, 3:13 PMval foo = Json.decodeFromString<Project>(string)
I see that the performance drops much more than others like jackson and GSON.
instead, if I instantiate the serializer and then reuse it, the performance works much better,
val serializer = serializer(typeOf<Project>()) as KSerializer<Project>
val foo = Json.decodeFromString(serializer, string)
Is there a problem with doing it this way?
more details in https://github.com/jcaromiq/serde-benchmarkhfhbd
08/07/2022, 7:32 PMserializer(typeOf())
results into a reflection like lookup at runtime to find the serializer. If you statically know the serializer, you could provide it Json.decodeFromString(Project.serializer, string)
, which is faster without a runtime lookup.ephemient
08/07/2022, 8:06 PM