Every call to decode() creates a brand-new parser instance with the default capacity, which reserves tens of MiB of buffers. For repeated decoding (e.g. many small JSON payloads in a loop), this is a lot of avoidable allocation and GC pressure.
See SimdJson.kt.
Worth reusing a parser instance (with appropriate thread-safety/reset handling) across decode calls instead of allocating one per call.
Every call to
decode()creates a brand-new parser instance with the default capacity, which reserves tens of MiB of buffers. For repeated decoding (e.g. many small JSON payloads in a loop), this is a lot of avoidable allocation and GC pressure.See
SimdJson.kt.Worth reusing a parser instance (with appropriate thread-safety/reset handling) across decode calls instead of allocating one per call.