Serializing maps produces too much bytes comparing to Protobuf and CBOR. Not sure, if it's something with avro itself or schema generation. I believe this is significant because the main and only reason to use binary formats is that they could be compact and safe regardless of the user content (no need to escape anything).
@Serializable
data class X(
val v: Int,
val map: Map<String, String>
)
@OptIn(ExperimentalSerializationApi::class)
fun main() {
val data = X(1, emptyMap())
ProtoBuf.encodeToByteArray(data).let { println("Protobuf: ${it.size}") }
Avro.default.encodeToByteArray(data).let { println("Avro: ${it.size}") }
Cbor.encodeToByteArray(data).let { println("Cbor: ${it.size}") }
}
Serializing maps produces too much bytes comparing to Protobuf and CBOR. Not sure, if it's something with avro itself or schema generation. I believe this is significant because the main and only reason to use binary formats is that they could be compact and safe regardless of the user content (no need to escape anything).
Produces: