Comparison · different, not better
Every format here is good at what it was designed for. This page lists what each one guarantees, so you can tell which guarantees your problem needs.
Binary IDLs
All four use a schema known to both ends. They differ in what the schema lets the bytes vary on, and in how much of that variation is allowed.
| Property | Fomoxa | Protocol Buffers | FlatBuffers | Cap'n Proto |
|---|---|---|---|---|
| One value → one byte sequence | RequiredTwo valid encodings of the same value do not exist (RFC-0002). | Not canonicalThe docs state serialization "is not (and cannot be) canonical". | Not canonicalField and object order are left undefined; two encoders may differ and both be valid. | Canonical form defined, optionalA canonical form exists for signing; encoders need not use it. |
| How the schema is written | Not mandatedThe spec has no IDL. fomoxac reads annotations on your own types, one language per run: a model shared by two languages is written in both, and a schema fingerprint checks that they match. |
.proto IDLOne file, generated message classes for every language. |
.fbs IDLOne file, generated accessors for every language. |
.capnp IDLOne file, generated readers/builders for every language. |
| Code generators | 7 fomoxac targetsRust, C#, Go, C, C++, TypeScript, JavaScript. The spec itself names no language. | 10 supported by GoogleEight built into protoc, plus Dart and Go as plugins. More from third parties. |
14 listedC++, C#, C, Go, Java, Kotlin, JavaScript, Lobster, Lua, TypeScript, PHP, Python, Rust, Swift. | C++ referenceImplementations in 15 more languages by other authors, not reviewed by the project; completeness varies. |
| Field identity on the wire | PositionNo tags, no names. Declaration order is the identity. | Field numberA tag with each field. | vtable slotOffsets looked up through a vtable. | Ordinal → fixed offsetLayout computed from @n ordinals. |
| Integer encoding | Fixed width, LEu32 is 4 bytes, always. |
VarintSmall numbers take fewer bytes. | Fixed width, LEWith alignment padding. | Fixed width, LE8-byte word alignment; optional packing. |
| Schema evolution | Trailing edge onlyAppend or drop fields at the end of a Model. Anything else is a breaking change. | FlexibleAdd or remove fields anywhere; unknown fields are carried along. | Append, or explicit idsNew fields at the end of a table, or anywhere with id. Fields are deprecated, not removed. |
Append by ordinalNew fields get the next ordinal; old ones stay. |
| Optional / default values | NoneEvery field is always written. | YesDefaults may be omitted; presence tracking available. | YesDefaults are usually not written. | YesDefaults via XOR with the default value. |
| Read without parsing (zero-copy) | NoSequential decode; a String's offset depends on earlier fields. | No | YesDesigned for in-place access. | YesDesigned for in-place access. |
| Scope | Wire format onlyTransport, RPC and framing are out of scope. | Format + gRPC ecosystem | Format + optional gRPC | Format + capability RPC |
Sources: protobuf.dev · serialization is not canonical, overview · flatbuffers.dev, internals, evolution · capnproto.org · encoding, other languages. Checked September 2026.
Deterministic
The closest relatives. All three give a value exactly one encoding, write integers at a fixed width in little endian, and write struct fields in declaration order with no tags. They differ in the types they carry.
| Property | Fomoxa | Borsh | BCS |
|---|---|---|---|
| One value → one byte sequence | Required | YesDesigned for hashing. | Yes"Every value of a given type should have a single valid representation." |
| String and array lengths | u32, LE |
u32, LE |
ULEB128Variable width. |
| Floats | Bits preservedNaN payloads included. | NaN rejected | Not supported |
| Enums | u32 valueNo payload. |
u8 variant indexThen the variant's fields. |
ULEB128 variant indexThen the variant's fields. |
| Optional values | NoneNo marker for absence. | 1-byte tag | 1-byte tag |
| Maps | None in v1 | Sorted by key | Sorted by key bytes |
| Origin | Standalone specificationRFCs written apart from any language, RFC-0003 vectors as the pass mark. | NEARSpecification, with implementations in Rust, TypeScript, Go, Java, Python, C# and more. | DiemSpecified alongside its Rust (Serde) implementation. |
If your system already runs on Borsh or BCS, you have the determinism guarantee Fomoxa is built around. Fomoxa's differences are narrower: fewer types, float bits kept exactly, and a specification that belongs to no single language.
Sources: borsh.io, github.com/near/borsh · github.com/diem/bcs. Checked September 2026.
Schemaless
JSON and MessagePack are self-describing: a reader needs no schema. Fomoxa is the opposite: without the schema the bytes mean nothing.
| Property | Fomoxa | JSON | MessagePack |
|---|---|---|---|
| One value → one byte sequence | Required | NoKey order, whitespace and number formatting vary. RFC 8785 (JCS) defines a separate canonical form. | NoThe spec says serializers should pick the shortest format; map key order is not specified. |
| Self-describing | NoWrong schema → wrong values, often without an error. | YesField names and types travel with the data. | YesType markers travel with the data. |
| Schema evolution | Trailing edge only | Application-definedReaders typically ignore unknown keys. | Application-defined |
| Numbers | Exact width and bitsFloat bit patterns, NaN payloads included, are preserved. | TextPrecision depends on the parser; no NaN or Infinity. | Typed, variable widthEncoder chooses among valid widths. |
| Human-readable | NoUse fomoxa-inspect or the inspector. |
Yes | No |
Same value
Player{ id: 100, name: "Alice" }. Byte counts are for this value only.
Change the value and the ranking can change.
# Fomoxa · 13 bytes 64 00 00 00 05 00 00 00 41 6C 69 63 65 id length A l i c e # the only valid encoding
# Protobuf · 9 bytes (id = 1, name = 2) 08 64 12 05 41 6C 69 63 65 tag varint tag len A l i c e # fields may also appear in another order
# MessagePack · 16 bytes (as a map) 82 A2 69 64 64 A4 6E 61 6D 65 A5 41 6C 69 63 65 # 100 may also be written CC 64, D0 64, ... # 8 bytes as an array: 92 64 A5 41 6C 69 63 65
# JSON · 25 bytes {"id":100,"name":"Alice"} # equally valid: {"name":"Alice","id":1e2}
Fomoxa is not the smallest here: fixed-width integers cost bytes that varints save. What it buys is that the first block is the only valid answer, in every conforming implementation.
Measured
From fomoxa-codec-bench: the same game-shaped
messages in Rust, fomoxac against prost and capnp, the latter both
standard and in its canonical form, the one you would hash or sign. Medians from one run on 2026-09-18.
| Message | Fomoxa | Protobuf (prost) | Cap'n Proto | Cap'n Proto canonical |
|---|---|---|---|---|
| input a moving player |
21 Bencode 9.1 ns decode 25.1 ns |
26 Bencode 28.0 ns decode 34.5 ns |
40 Bencode 43.4 ns decode 77.2 ns |
32 Bencode 141 ns decode 111 ns |
| input a player standing still |
21 Bencode 9.1 ns decode 25.0 ns |
2 Bencode 12.7 ns decode 14.8 ns |
40 Bencode 43.1 ns decode 76.9 ns |
16 Bencode 109 ns decode 110 ns |
| stats small counters |
38 Bencode 10.8 ns decode 29.0 ns |
24 Bencode 74.8 ns decode 76.1 ns |
56 Bencode 49.2 ns decode 66.9 ns |
48 Bencode 121 ns decode 111 ns |
| chat 64-character string |
82 Bencode 20.2 ns decode 48.9 ns |
79 Bencode 33.8 ns decode 73.7 ns |
112 Bencode 58.9 ns decode 118 ns |
104 Bencode 165 ns decode 197 ns |
| batch-100 100 transforms |
2,908 Bencode 684 ns decode 2.56 µs |
3,586 Bencode 6.40 µs decode 6.58 µs |
3,240 Bencode 289 ns decode 1.39 µs |
3,232 Bencode 847 ns decode 1.58 µs |
| batch-1000 1000 transforms |
29,008 Bencode 8.67 µs decode 25.18 µs |
36,625 Bencode 72.35 µs decode 64.90 µs |
32,040 Bencode 3.35 µs decode 12.58 µs |
32,032 Bencode 8.75 µs decode 13.75 µs |
prost on typical data: 1.7–9.4x faster to encode, 1.4–2.8x faster to decode.batch-1000 2.6x faster and decodes it 2x faster.batch-1000 encode and still decodes batches 1.6–1.8x faster.stats 24 bytes against 38.
Read it with its limits: Rust only, one implementation per format, synthetic data, one laptop under WSL2,
loopback only. Every decoder builds the same owned struct; reading Cap'n Proto in place, as it is designed to
be read, is cheaper and not measured. In the
example game, at
1000 players the full server stacks were indistinguishable (0.3 ms p50), because the codec is a tiny share of
the tick. Run scripts/run.sh on your own message shapes before you decide.
Choosing
The full reasoning is in RFC-0001 §3.3 and §5.3.