I agree, and in .NET that’s a solved problem: http://const.me/articles/net-tcp/ (2010).
Their text format is XML. Their binary version takes small fraction of bandwidth, especially when using a custom pre-shared XML dictionary. Binary is much cheaper to produce or parse, the built-in DataContractSerializer understands both formats. Supported by all modern editions of .NET including .NET Core and is compatible across them, e.g. I’ve been recently using it for a network protocol of a Linux ARM device.
Exchanging text makes the format easier to debug and accessible to humans, which can be a purpose in itself.
Human accessibility is an absolute must for any modern format.
[1] https://github.com/kstenerud/concise-encoding/blob/master/cb...
[2] https://github.com/kstenerud/concise-encoding/blob/master/ct...
The implementations are almost done now, and my first tool will be a command line utility that reads one format and spits out the other, so that you can take a binary dump from your production system using tcpdump or wireshark or whatever, and then convert it to a human readable format to see what's going on. I'll probably even put in a hex-reader so that you can log the raw message and then read it back:
2019-10-02:15:00:32: Received message [01 76 85 6e 75 6b 65 73 88 6c 61 75 6e 64 68 65 64 79]
$ ceconv --hex 01 76 85 6e 75 6b 65 73 88 6c 61 75 6e 64 68 65 64 79
v1
{
nukes = launched
}The project still seems cool, I'll have to have a deeper look into it soon
Protobufs are neat but `protoc` is an absolute nightmare. I would warn against going down the path of transpiling to lang-specific message files if at all possible (I don't think you are taking that approach, but github freezes my phone browser, I'll look more on my dev machine)
Great stuff! I would love to see this get more traction. Interchange formats are a classic victim of critical mass necessity.
* Doesn't have a sister text format for human editing.
* Uses raw uncompressed types for integers and floats, which wastes space
* Doesn't support arbitrary sized/precision numeric types
* Timestamp format uses seconds instead of Gregorian fields (which means that your implementation must keep a leap second database, and time conversions are complicated)
* No time zones
* Doesn't have metadata, comments, or references
* Container types have an unnecessary length field
* Stores data in big endian byte order (an unnecessary expense since all popular modern chips are little endian)
* Wastes an extra bit for negative integers
* 32-bit limitations on length (so max 4gb payload sizes)
* No versioning of documents
Regarding the point about having a sister text format, I suppose I'd tend to view JSON as filling that role. Not to bother you for a second comparison, but if you happen to have it handy seeing how CTE compares to JSON in terms of encoding efficiency would be interesting to me.
Edit: I found a list of MessagePack <--> JSON limitations that I hadn't really thought about! (https://github.com/ludocode/msgpack-tools#differences-betwee...)
It seems your format is yet another attempt at reinventing ASN.1.
That's why I split it into compatible text and binary formats. You transmit/store in binary, and read/edit in text, and the computer deals with the conversion automatically.
I can see with a few more small parts an application which persists as bson, streams / tempfile / and/or mmaps to yaml/hcl/whatever you like, opens that in your editor of choice, and translates back to bson.
Text encoding/decoding wastes massive amounts of energy, which is why I've been developing a format over the past 2 years with the benefits of binary (smaller, more efficient) as well as text (human readability/editability): https://github.com/kstenerud/concise-encoding