Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Comparison Matrix

How TeaLeaf compares to other data formats.

Feature Comparison

FeatureJSONYAMLProtobufAvroMsgPackCBORTeaLeaf
Human-readable textYesYesNo*NoNoNoYes
Compact binaryNoNoYesYesYesYesYes
Schema in textNoNoExternalExternalNoNoInline
Schema in binaryNoNoNoYesNoNoYes
No codegen requiredYesYesNoPartialYesYesYes
CommentsNoYesN/AN/ANoNoYes
Built-in JSON conversionNoNoNoNoYes
String deduplicationNoNoNoNoNoNoYes
Per-section compressionNoNoNoYesNoNoYes
Null bitmapsNoNoNoYesNoNoYes
Random-access readingNoNoNoNoNoNoYes

*Protobuf TextFormat exists but is rarely used.

Size Comparison

FormatSmall Object10K Points1K Users
JSON1.00x1.00x1.00x
YAML~1.1x~1.1x~1.1x
Protobuf0.38x0.65x0.41x
MessagePack0.35x0.63x0.38x
CBOR~0.40x~0.65x~0.42x
TeaLeaf Binary3.56x0.15x0.47x

Speed Comparison

OperationJSON (serde)ProtobufMsgPackTeaLeaf
Parse textFastN/AN/AModerate
Decode binaryN/AFastFastModerate
Encode textFastN/AN/AModerate
Encode binaryN/AFastFastModerate
Random key accessO(n) parseO(1) generatedN/AO(1) hash

When to Use Each Format

Use TeaLeaf When

ScenarioWhy
LLM context / promptsSchema-first reduces token count
Config files (human-edited + deployed)Text for editing, binary for deployment
Large tabular data6-7x compression with string dedup
Self-describing data exchangeNo external schema files needed
Game save data / asset manifestsCompact, nested, self-describing
Scientific/sensor dataNull bitmaps for sparse data

Use JSON When

ScenarioWhy
Web APIs / RESTUniversal support
Small payloads (< 1 KB)No overhead
JavaScript-heavy applicationsNative parsing
Human-only data (no binary needed)Simpler tooling

Use Protobuf When

ScenarioWhy
RPC / gRPC servicesFirst-class streaming support
Maximum decode speedGenerated code with known offsets
Schema evolution at scaleField numbers + backward compat
Microservice communicationEstablished ecosystem

Use Avro When

ScenarioWhy
Hadoop / big data pipelinesEcosystem integration
Schema registry workflowsBuilt-in evolution
Large-scale data lake storageBlock compression

Use MessagePack / CBOR When

ScenarioWhy
Tiny payloads (< 100 bytes)Minimal overhead
Schemaless binaryNo schema definition needed
Drop-in JSON replacementSimilar data model

Ecosystem Maturity

AspectJSONProtobufAvroTeaLeaf
Language supportUniversal10+ languages5+ languagesRust, .NET
ToolingExtensiveExtensiveModerateCLI + libraries
CommunityMassiveLargeMediumEarly
Specification maturityRFC 8259Stable (proto3)Apache specBeta
IDE supportUniversalPluginsPluginsPlanned

TeaLeaf is a young format (v2.0.0-beta.8). It fills a specific niche that existing formats don’t serve well – but it doesn’t aim to replace established formats in their core use cases.