6 ms·
I created a binary serialization format and library that is comparable to json but binary. It uses 1-byte tags to give type information, which often already con
by stkdump 6y ago
I created a binary serialization format and library that is comparable to json but binary. It uses 1-byte tags to give type information, which often already contains the value (in case of 0,1,true,false,null,empty string, empty list, empty object, single letter string or one of the last 32 interned strings) very similarly to msgpack. But it has the advantage, that strings are interned, which does about the same for performance as a runtime schema-based thing like Avro, but is more generic. Also, like bencode, it uses the convention that keys in objects are sorted, so that linear deserialization directly into the target objects is much simpler. And instead of prepending the size or length of objects and lists, there is a separate end-tag, so that you can start streaming data, before you know how much it will be. Sure, you can't skip without reading the data you skip over, but you (the receiver) can just do an initial pass and store the skip information in a cache, if you need. That seems better than requiring the sender to do multipass without knowing if anyone will ever use the skip info.