FWIW the README is excellent. Background, goals, and comparisons.
Also lol
> Q: Why didn't you write this in $NEW_LANGUAGE instead of crufty C++?
> A: I probably should have! $NEW_LANGUAGE is deservedly attracting a lot of attention for its combination of safety, readable syntax, and support for modern programming paradigms. I've been trying out $NEW_LANGUAGE and want to write more code in it. But for this I chose C++ because it's supported on all platforms, lots of people know how to use it, and it still supports high-level abstractions (unlike C.)
I'd be curious to see the difference in size / performance with gzipped data in the mix. My guess is that gzipping will make the size difference negligable (may actually be worse in Fleece due to the abundance of pointers that can't be easily compressed). The times might be worse, but if this is intended as a wire format then that might not matter as much.
It seems to be maybe a bit less compact in terms of absolute number of bytes, but faster to parse. That is, parsing is just one-pass validation, and then data can be read directly from the buffer without an intermediate structure, with random access. It also has a notion of "pointer" so you can introduce sharing (a smart-ish encoder might use that to reuse common keys or strings, making the result smaller).
I went down the rabbit hole of trying to find the best binary JSON-ish format a couple of years ago, it's very interesting to compare their different design choices. Having read the specification, this looks to be a fresh and minimalist take on a binary format, which is great.
In general, it seems CBOR won the standardisation and support battle while also being one of the more complex and ambiguous (in terms of the number of ways to encode something) formats. I think MessagePack is nicer, though I still wish UBJSON caught on.
7 comments
[ 0.27 ms ] story [ 40.2 ms ] threadAlso lol
> Q: Why didn't you write this in $NEW_LANGUAGE instead of crufty C++?
> A: I probably should have! $NEW_LANGUAGE is deservedly attracting a lot of attention for its combination of safety, readable syntax, and support for modern programming paradigms. I've been trying out $NEW_LANGUAGE and want to write more code in it. But for this I chose C++ because it's supported on all platforms, lots of people know how to use it, and it still supports high-level abstractions (unlike C.)
In general, it seems CBOR won the standardisation and support battle while also being one of the more complex and ambiguous (in terms of the number of ways to encode something) formats. I think MessagePack is nicer, though I still wish UBJSON caught on.