Cap'n Proto

Cap'n Proto is a serialization format and RPC system meant to be an improved version of Protocol Buffers, written by the same author. Its major claimed advantage over Protocol Buffers is fast serialization and very fast deserialization; parsing is done lazily and much more simply than in Protocol Buffers, mostly amounting to a small amount of bounds-checking. Compare Simple Binary Encoding and FlatBuffers in this regard.

Extensions
Cap'n Proto schema files have the extension ".capnp". It is not clear what, if any, extensions may be in use for the serialized format.

Segments
Cap'n Proto messages are generally divided into several units called "segments" in order to make construction of the message easier. Messages using segments begin with a "segment table" and then the content of those segments. It is possible to write a "flat" message that takes up a single segment, however, the help text of the CLI calls this "rare".

Packing
Cap'n Proto defines a very simple compression format called the "packing" format, which is essentially a variant of run-length encoding that only encode runs of bytes with value 0x00. This is especially useful because Cap'n Proto does not leave out zero-valued fields, and so without packing, messages may consist of long runs of zero bytes for the values of uninitialized fields. Packing can in many cases significantly reduce file size. See for details on the format.

Canonical Form
"Canonicalized" messages are those belonging to a well-defined subset of the regular message format. Where packing is used on canonicalized messages, it is taken as a container rather than as part of the format (unlike for non-canonicalized messages). See for a specification.

Software

 * Official library
 * Includes a CLI capable of dumping, converting, etc. messages
 * Debian packages capnproto, libcapnp-*
 * List at

Links

 * Official website
 * Show HN: Cap'n Proto, by the ex-maintainer of Protocol Buffers
 * Hacker news: Cap’n Proto
 * What's the difference between the Protocol Buffers and the Flatbuffers?