Skip to main content
Search Documentation & Spec
Type to search all 17 pages

Runtime benchmarks.

Inspect OmniBuf against Protobuf, JSON, and native serializers in each of the 11 supported languages, or compare runtimes side by side on the same Apple M1 Pro workload.

Benchmark Explorer · 11 Languages · 6 Workloads
Shorter bars = Faster

Go benchmarks.

11-field PeerUpdate struct on Apple M1 Pro (Go 1.27.1). Shorter bars = Faster.

Go Guide →
Full Message Encode Speed

Serializing the 11-field Go struct into a reused byte slice. FlatBuffers and Cap'n Proto times include building the buffer from the struct.

OmniBuf (Generated)
1.0x (base)(104 ns)
OmniBuf (Go Struct Tags)
3.3x slower(346 ns)
Avro (Raw Binary)
4.0x slower(414 ns)
Protobuf
5.4x slower(557 ns)
FlatBuffers
5.4x slower(560 ns)
Cap'n Proto
9.8x slower(1,020 ns)
MessagePack
15.3x slower(1,592 ns)
JSON (encoding/json/v2)
16.2x slower(1,686 ns)
JSON (encoding/json)
16.3x slower(1,690 ns)
Full Message Decode Speed

Unpacking and reading all 11 fields into a reused destination struct across every codec, including Protobuf.

OmniBuf (Generated)
1.0x (base)(184 ns)
FlatBuffers
1.0x slower(193 ns)
OmniBuf (Go Struct Tags)
2.0x slower(360 ns)
Avro (Raw Binary)
2.2x slower(409 ns)
Cap'n Proto
4.2x slower(769 ns)
Protobuf
5.2x slower(955 ns)
MessagePack
11.9x slower(2,183 ns)
JSON (encoding/json/v2)
14.9x slower(2,733 ns)
JSON (encoding/json)
18.7x slower(3,445 ns)
Read a Single Nested Field

Reading a nested string field directly from the raw byte slice. Cap'n Proto and FlatBuffers use offset tables; OmniBuf hops over preceding field headers by length.

Cap'n Proto
17.0x faster(5 ns)
FlatBuffers
3.1x faster(27 ns)
OmniBuf
1.0x (base)(85 ns)
Avro (Raw Binary)
5.6x slower(472 ns)
MessagePack
7.1x slower(601 ns)
Protobuf
11.7x slower(995 ns)
Selective Single-Field Mutation

Checking a nested city string, incrementing the 64-bit sequence counter, and returning the updated packet. OmniBuf splices the field in place; the others decode and re-encode.

OmniBuf (Opaque Splice)
1.0x (base)(219 ns)
FlatBuffers
3.5x slower(767 ns)
Avro (Raw Binary)
3.9x slower(855 ns)
Protobuf
7.3x slower(1,596 ns)
Cap'n Proto
8.6x slower(1,882 ns)
MessagePack
18.1x slower(3,967 ns)
JSON (encoding/json/v2)
20.6x slower(4,501 ns)
JSON (encoding/json)
24.7x slower(5,412 ns)
Large Embedded Message Encode

Serializing a 39 KiB packet whose 20 KiB and 18 KiB nested sub-messages exceed the 2-byte 16,383 B length reservation and trigger 2B-to-4B header shifts.

OmniBuf (Generated)
1.0x (base)(650 ns)
FlatBuffers
1.7x slower(1,079 ns)
Protobuf
2.6x slower(1,697 ns)
OmniBuf (Go Struct Tags)
2.6x slower(1,698 ns)
Avro (Raw Binary)
10.1x slower(6,572 ns)
Cap'n Proto
11.8x slower(7,688 ns)
MessagePack
18.4x slower(12.0 µs)
JSON (encoding/json/v2)
48.6x slower(31.6 µs)
JSON (encoding/json)
50.4x slower(32.8 µs)
Embedded Message Growth

Growing a nested string field past 16 KiB ahead of 32 trailing Neighbor entries via Opaque splicing vs full decode and re-encode.

OmniBuf (Opaque Splice)
1.0x (base)(861 ns)
FlatBuffers
3.5x slower(2,981 ns)
Avro (Raw Binary)
6.6x slower(5,689 ns)
Protobuf
8.0x slower(6,905 ns)
Cap'n Proto
9.8x slower(8,441 ns)
MessagePack
27.2x slower(23.4 µs)
JSON (encoding/json/v2)
38.3x slower(32.9 µs)
JSON (encoding/json)
41.2x slower(35.4 µs)
Go Environment
CPU: Apple M1 Pro (darwin/arm64)
Compiler: Go 1.27.1
Samples: 5 × 250 ms, CPU=1
Workload: 11-field PeerUpdate (366 B)

M1 Pro MacBook Pro, Go 1.27.1 (GOEXPERIMENT=jsonv2), -benchtime=250ms -count=5 -cpu=1. Every decode benchmark reads all 11 fields into a non-inlined checksum sink and reuses the destination struct across codecs, including Protobuf.

Benchmark source lives in benchmarks/omnibuf_bench_test.go, benchmarks/opaque_table_bench_test.go, benchmarks/jsonv2_bench_test.go, and benchmarks/competitors_test.go, with recorded output in testdata/benchmarks.txt and testdata/benchmarks.json.

Wire size.

Packet size is identical across all 11 OmniBuf runtimes. Protobuf saves ~7% on dense messages by omitting type disambiguation, while OmniBuf stays 35% to 54% smaller than Cap'n Proto, FlatBuffers, MessagePack, and JSON.

Even with optional Field #0 metadata enabled (writing field names once at the top of the packet), OmniBuf is still 4% smaller than MessagePack.

Packet Size on the Wire · 11-Field PeerUpdate
Avro (Raw, No Field Tags)
-14% smaller(313 B)
Protobuf
-7% smaller(341 B)
OmniBuf
1.0x (base)(366 B)
Cap'n Proto
+53% larger(560 B)
FlatBuffers
+64% larger(600 B)
OmniBuf (With Field #0 Names)
+72% larger(630 B)
MessagePack
+79% larger(656 B)
JSON
+119% larger(803 B)
Avro OCF (With Schema Header)
+271% larger(1,359 B)

Benchmark methodology.

Every runtime runs the same six workloads on the same Apple M1 Pro machine against idiomatic Protobuf, JSON, and native serializers. Each test targets a specific wire-format property so fast paths cannot hide regressions elsewhere.

Test Payloads & Equal-Footing Rules

Shared Payloads

The primary workload is an 11-field PeerUpdate struct with unsigned and signed integers, booleans, UTF-8 strings, a nested Location sub-message, packed integer arrays, and repeated nested peer entries (366 B in OmniBuf, 341 B in Protobuf, 803 B in JSON). The large-embed and growth workloads use a ~39 KiB message with embedded sub-messages exceeding OmniBuf's 16 KiB 2-byte length slot, forcing the 4-byte container length path.

No Dead-Code Elimination

Every full-decode benchmark reads all 11 fields into a non-inlined checksum sink so lazy wrappers (such as C upb arenas or FlatBuffers tables) perform the same field materialization as eager structs.

Equal Reuse & Warmup

Where a benchmark reuses output buffers or destination structs, every competitor in that chart gets the same reuse. AOT languages compile with release optimizations (-O3, --release, -c release), and JIT runtimes (V8, JVM C2, .NET RyuJIT) warm up before timing. Every harness and recorded JSON output lives in its language repository under benchmarks/ and testdata/benchmarks.json.

Why These Six Benchmarks

Full Message Encode Speed

Serializes the 11-field PeerUpdate struct into a byte buffer. Every RPC response, event producer, and cache write hits full-message encoding on the hot path, and this workload directly tests whether single-pass 2-byte length slots and Prefix-Varint writes outperform Protobuf two-pass Size() walks and LEB128 loops.

Full Message Decode Speed

Unpacks all 11 fields of PeerUpdate into a destination struct and feeds every field into a non-inlined checksum sink. Reading every field prevents lazy wrappers from skipping work and isolates trailing-zero Prefix-Varint loads and packed primitive arrays against LEB128 byte loops and JSON tokenizers under equal struct reuse.

Read a Single Nested Field

Extracts one nested string (location.city) straight from raw wire bytes. Proxies, routers, and log filters often inspect a single routing key inside a larger payload, so this test highlights length-prefixed field skipping over Protobuf and JSON full decodes while showing honestly where FlatBuffers and Cap'n Proto offset tables stay faster.

Selective Single-Field Mutation

Checks location.city, increments a 64-bit sequence counter, and returns updated packet bytes. Middleware and stream processors frequently validate one field, stamp a counter or flag, and forward the message, making this the direct test of Opaque in-place field splicing against a full decode, allocate, and re-encode cycle.

Large Embedded Message Encode

Encodes a ~39 KiB message with embedded sub-messages exceeding OmniBuf's 16 KiB 2-byte length slot. Real batch responses and nested blobs routinely cross 16 KiB, so this benchmark exercises the 4-byte container length fallback path to confirm the 2-byte fast path is not masking a performance cliff on large payloads.

Embedded Message Growth

Measures encode latency as embedded sub-message sizes scale up across multiple thresholds. Tracking growth catches quadratic buffer shifting or repeated re-sizing early and verifies linear O(N) scaling across container sizes.