Headlines (1,000 records; compact JSON = 100%, lower is better)
Nested master/detail records (invoices — where flat formats can't compete)
| Format | Bytes | Tokens (o200k) | Tokens (cl100k) | Tokens (Llama 3) | Tokens (Claude legacy) | Lossless round-trip |
|---|---|---|---|---|---|---|
| ICF | 52% | 78% | 77% | 77% | 72% | yes |
| JSON (compact) | 100% | 100% | 100% | 100% | 100% | yes |
| JSON (pretty) | 163% | 163% | 163% | 163% | 162% | yes |
| YAML | 116% | 127% | 125% | 125% | 122% | yes |
| XML | 136% | 142% | 144% | 144% | 142% | no* |
Flat records (students — CSV's home turf)
| Format | Bytes | Tokens (o200k) | Tokens (Claude legacy) | Handles nesting |
|---|---|---|---|---|
| ICF | 55% | 72% | 68% | yes |
| JSON (compact) | 100% | 100% | 100% | yes |
| YAML | 97% | 118% | 107% | yes |
| CSV | 48% | 62% | 67% | no |
In short: ICF carries hierarchical data at roughly half the bytes of compact JSON and 21–32% fewer tokens (tokenizer-dependent), while staying lossless — close to CSV's compactness without giving up nesting. After gzip the byte differences shrink (ICF ≈ 90% of gzipped JSON); the token advantage is the one compression cannot recover inside an LLM context window.
Throughput (1,000 nested records, median ms — a JavaScript-only measurement)
| Library | Parse | Serialize |
|---|---|---|
JSON (native JSON.parse) | 22 | 11 |
| ICF (icf.js) | 98 | 51 |
| XML (fast-xml-parser) | 707 | 61 |
| YAML (yaml) | 3,987 | 455 |
Read this honestly: native JSON parsing (C++ inside V8) is ~4× faster than icf.js; icf.js is in turn ~7× faster than the popular XML parser and ~40× faster than the YAML parser. This compares Node libraries only — it is not a cross-language claim.
Method
- The corpus is generated from fixed seeds — every run on every machine measures byte-identical inputs.
- Every format serializes the same logical tree; all values are strings, so no format gains or loses from number formatting.
- ICF text comes from icf.js schema inference: the schema is declared once, records are positional rows — which is precisely where the savings come from.
- The Claude tokenizer package implements the legacy Claude BPE (current Claude tokenizers are not public); it is included as a distinct family, not a billing claim.
- * XML's "no" on fidelity reflects the array/type ambiguity of naive XML round-trips with default settings.
Full tables (three corpus sizes, gzip columns, both corpora) and the harness: icformat/icf-benchmarks. Reproduce with npm install && node src/run.mjs.