Contents:

Format Comparisons

Comparison to CBOR

CBOR is probably the closest in spirit to what e-NON wants to do. Some similarities:

There are a few other similarities, but some of the design choices are limiting.

First, the 3/5 split of the prefix byte is extremly wasteful due to redundancy. For example, 64 of the possible 256 prefixes are used just to introduce integers. Another 64 are reserved for strings. This means that half of the available prefix codes are consumed by 2 data types.

The problem seems to be the 3-bit pre-prefix, which divides the 256 prefixes into 8 “Major Type” zones of 32 values each. This forces redundancy. For example:

That accounts for (5*24)+(8*4) = 152 prefixes that provide only 28 distinct values.

Second, the 8 prefix divsions place arbitrary restrictions on prefix semantics. There are unused prefix values, but new prefixes have to fit into one of the 8 divisions. The “semantic tag” offers virtually unlimited extensions, but those are “second-class” prefixes, requiring extra bytes to specify.

e-NON takes a different approach.

e-NON interprets the 0..255 prefix range as follows:

range ASCII block e-NON usage
0x00..0x19, 0x7F control 33 control codes to introduce metadata, processing instructions, etc.
0x20..0x7E printable 95 prefixes for data types or other uses
0x80..0xFF extended numeric data values defining the range -63..64

Comparison to BSON, BON, JSON-B, etc.

These formats are extensions to JSON. As a result, they still have text-based roots.

Comparison to JSON

Size

Container Overhead
container entries (n) e-NON (bytes) JSON (bytes) O() e-NON:JSON notes
map <=250 2n+3 4n+1 O(n):O(n) Keys are strings, and includes string overhead for the keys. Assume key length < 250.
map >65,535 2n+4 4n+1 O(n):O(n) e-NON needs an extra byte to store the map size
map >=231 2n+11 4n+1 O(n):O(n) e-NON needs extra bytes to store the map size
list <=250 2 n+1 O():O(n)  
list >65,535 3 n+1 O():O(n) e-NON needs an extra byte to store the list size
list >=231 10 n+1 O():O(n) e-NON needs extra bytes to store thelist size
The analysis above considers an e-NON stream with minimal use of features, only that which is necessary to replicate the equivalent JSON.
Container Optimizations

e-NON has some optimizations that can be applied. These optimizations don’t impact the overhead analysis above, but they can decrease the total bytes under certain conditions.