NOVA vs Cap’n Proto, CBOR and MessagePack
CBOR and MessagePack are self-describing, but one value can be encoded in several ways, so equal data can hash differently. Cap’n Proto is fast but needs its schema. NOVA binary is self-describing and has exactly one canonical encoding per value.
CBOR a2 61 61 01 61 62 02
a2 61 62 02 61 61 01NOVA, canonical 0d 02 02 61 03 02 02 62 03 04
0d 02 02 61 03 02 02 62 03 04Record fields are sorted by key in the canonical encoding, so field order never changes the bytes or the revision. CBOR has an optional deterministic mode that does the same for CBOR. Canonical encoding, spec §5.2
What changes
| Topic | Binary formats | NOVA | Spec |
|---|---|---|---|
| Canonical form | MessagePack: none. CBOR: an optional deterministic profile | Exactly one, the basis of equality | §5.2 |
| Hashing | Agree on an encoding first | A sha256: revision of every value, used by patches | §2.13 |
| Types | Extension types and tags, agreed out of band | Decimals, rationals, timestamps, durations, sets, tuples and variants built in | §5.1 |
| Duplicate keys | Often accepted by decoders | Rejected by every decoder | §5.1 |
| Repeated keys | Written each time | Back-references and record lists write a key once | §5.3 |
| Framing | None built in | Frames with a magic number, optional schema reference and CRC-32 | §5.4 |
Migrating
The reference tools read and write CBOR, including its deterministic encoding. MessagePack and Cap’n Proto have no adapter.
nvf convert events.cbor --to nova
nvf convert events.nova --to binary-canonical -o events.nvb
nvf convert events.nova --to cbor-deterministic -o events.cbor
nvf hash events.novaTimestamps, big integers, decimals, rationals and sets map to registered CBOR tags. Durations, tuples and variants have none and are reported as lossy. CBOR mapping, spec §11.2
When to stay with them
- You need zero-copy reads or an RPC system. Cap’n Proto is built for that; NOVA decodes into values.
- You exchange MessagePack with existing services. NOVA has no MessagePack adapter yet; it is listed as future work.
- You need a format that is stable today. NOVA is a 0.1 draft.
Questions
Can NOVA read and write CBOR?
Yes, as specified in RFC 8949, with a deterministic mode. NOVA kinds without a registered CBOR tag are written with a loss warning.
Is NOVA binary smaller than CBOR?
It depends on the data. Run nvf stats FILE to see the bytes and an estimate of tokens for every representation of your own file.
Does a reformatted file get a new revision?
No. A revision covers the value only. Comments, formatting and field order do not change it, so reformatting never invalidates a pending patch.