HomeBenchmarks

Compression & Serialization Benchmarks

One dataset, one machine, one timing rule: how far apart gzip, brotli, zstd, deflate and LZ4 actually are. Every number is tagged with the runtime it depends on, because the snippet you copy out of a tutorial is usually not the C library.

Native CNode zlib (C) - server reference, NOT available in a browser
Web APICompressionStream/DecompressionStream - the web-stream codec API, run here in Node. Measured on this build: gzip/deflate/deflate-raw/brotli all construct and round-trip; zstd throws [not a valid enum value of type CompressionFormat] because the spec enum has no zstd. Only gzip and deflate have rows below.
WASMbrotli-wasm, lz4-wasm - shipped to the browser today
Pure JSpako, fflate, lz4js - dependency-free JavaScript
Fastest to decompress524.5 MB/szstd-19 · Native C
Smallest output27,870 B · 5.0%brotli-11 · Native C
Slowest to compress0.2 MB/sbrotli (wasm) · WASM

Decompression throughput · orders JSON MB/s of input · 553,706 B

zstd-19●native
524.5
lz4-block●wasm
480.7
zstd-1●native
456.4
deflate-9●native
413.6
deflate-6●native
404.7
gzip-9●native
396.0
brotli-11●native
386.6
gzip-6●native
367.6
brotli-4●native
272.8
gzip-1●native
269.4
zstd-3●native
252.5
brotli (wasm)●wasm
219.6
gzip (fflate)●JS
142.3
lz4-frame●JS
124.2
deflate (pako)●JS
102.3
gzip (pako)●JS
79.0
gzip (Web API)●web
75.4
deflate (Web API)●web
65.8
deflate (fflate)●JS
57.8

Compression throughput · orders JSON MB/s of input

lz4-block●wasm
387.2
zstd-1●native
362.9
gzip-1●native
234.4
zstd-3●native
167.5
lz4-frame●JS
154.6
brotli-4●native
80.1
deflate-6●native
79.5
gzip-6●native
73.1
deflate (Web API)●web
51.9
gzip (Web API)●web
49.3
deflate-9●native
37.4
gzip-9●native
36.3
deflate (pako)●JS
26.3
gzip (pako)●JS
26.2
deflate (fflate)●JS
22.9
gzip (fflate)●JS
22.1
zstd-19●native
1.1
brotli-11●native
0.4
brotli (wasm)●wasm
0.2

Full results for · orders JSON

CodecRuntimeOutputRatioCompress MB/sDecompress MB/s
zstd-19Native C29,618 B5.3%1.1524.5
lz4-blockLZ4 block, no headerWASM97,646 B17.6%387.2480.7
zstd-1Native C45,911 B8.3%362.9456.4
deflate-9Native C47,542 B8.6%37.4413.6
deflate-6Native C52,133 B9.4%79.5404.7
gzip-9Native C47,554 B8.6%36.3396.0
brotli-11Native C27,870 B5.0%0.4386.6
gzip-6Native C52,145 B9.4%73.1367.6
brotli-4Native C43,625 B7.9%80.1272.8
gzip-1Native C65,856 B11.9%234.4269.4
zstd-3zstd's own default levelNative C45,734 B8.3%167.5252.5
brotli (wasm)default qualityWASM27,871 B5.0%0.2219.6
gzip (fflate)Pure JS54,146 B9.8%22.1142.3
lz4-frameLZ4 frame, has headerPure JS95,766 B17.3%154.6124.2
deflate (pako)Pure JS52,133 B9.4%26.3102.3
gzip (pako)Pure JS52,145 B9.4%26.279.0
gzip (Web API)browser-native gzipWeb API52,145 B9.4%49.375.4
deflate (Web API)browser-native deflateWeb API52,133 B9.4%51.965.8
deflate (fflate)Pure JS54,128 B9.8%22.957.8

Serialization: the same 1,000 records

JSON
553,706 B
Protobuf
246,928 B

Protobuf is 44.6% of the JSON size (−55.4%). Encode 8.75 ms vs JSON.stringify 4.97 ms; decode 3.61 ms vs JSON.parse 4.45 ms.

Methodology

How
median of 15 timed rounds (5 for the brotli quality-11 rows) after 2 warmups; all outputs round-trip verified; bytes exact, MB/s indicative
Runtime
v24.22.0 · win32-x64
Combinations
114 rows (19 codecs × 6 payloads), all round-trip verified
Libraries
protobufjs@8.8.0 · pako@3.0.1 · lz4js@0.2.0 · brotli-wasm@3.0.1 · lz4-wasm@0.9.2 · fflate@0.8.3
What the Web API rows really are
Every row, including the CompressionStream ones, was timed inside Node — it ships the same API the browser does. The web-api, wasm and pure-JS rows are therefore codecs a browser can run, measured on a server. A browser would move the MB/s; it would not move a single output byte.
Generated
2026-11-18T16:24:04.726Z

Byte counts are exact and reproducible; MB/s is indicative — two consecutive runs of this harness on 2026-11-19 agreed on all 114 rows byte for byte, while the median MB/s figure moved 25.2%, 127 of the 227 figures moved by more than 20%, and the worst single figure by 347%. The dataset, the scripts, the pinned dependency manifest and the bundled JS fixture are all public: results.json · results.csv · bench.mjs · payloads.mjs · zstd-ladder.mjs · zstd-ladder.csv · zstd-params.mjs · zstd-params.csv · overhead.mjs · compression-overhead.csv · package.json · package-lock.json · real-js-chunk.js

To re-run it: put bench.mjs, payloads.mjs, package.json, package-lock.json and real-js-chunk.js in one folder and run npm ci && node bench.mjs — Node 22.15.0 or newer (v23.8.0 and up on the non-LTS line), no build step: that is when node:zlib grew zstd. An older Node still completes the run but emits 96 rows instead of 114 and prints why. It emits one row per codec x payload pair and stops with an error rather than quietly dropping a payload. The level ladder is the same five files plus node zstd-ladder.mjs and the crossover sweep is the same five files plus node overhead.mjs , and the forced-parameter sweep (192 rows of strategy and windowLog against the level dial) is the same five files plus node zstd-params.mjs.

All raw data is public: results.json · results.csv · datasets page — the data files are CC BY 4.0; reuse them with credit to DevKit (hcatree.com).

How to read these numbers

Identical bytes, 3.0× the speed

On orders JSON the three deflate implementations produce exactly the same 52,133 bytes: Node zlib at 79.5 MB/s, pako in pure JS at 26.3 MB/s, and the browser's own CompressionStream at 51.9 MB/s. Same format, same level, same output — the only variable left is the implementation.

A format is not one number

gzip level 1 buys 234 MB/s by spending 38% more output; level 9 is 8.59% at 36.3 MB/s; brotli-11 manages 0.4 MB/s, 586× slower than gzip-1. "gzip is fast" with no level attached is a claim about nothing.

The payload decides

Across all 19 codecs on random bytes, every compression ratio lands between 100.0% and 100.4% — true randomness is not compressible, so nobody wins there. Switch to high-repeat text and every format looks brilliant. Change the payload column and the ranking reshuffles.

Only what runs in your browser is yours

Chromium's CompressionStream accepts gzip, deflate and deflate-raw and throws on both brotli and zstd — measured here. Safari 18.4 and Firefox 147 have brotli; Chrome still does not. zstd exists in no browser's implementation of this API, and in Firefox 138 only behind a flag. So brotli in a browser means carrying WASM: 0.2 MB/s to compress. That is not brotli being slow — it is what happens when a C library is swapped for a wasm one. Decompression is still 220 MB/s, so the whole cost sits on whichever side does the compressing.

The dial is not monotonic

On high-repeat text, brotli quality 3 emits 52 bytes and quality 11 emits 61 — the maximum setting is 9 bytes *bigger*, at 29× the cost. zstd holds 79 bytes flat from level 1 to 12 on the same payload, then goes to 80 above 15. "Turn it up" is not a free conservative choice; sometimes it is simply the worse one.

Both cliffs, measured

On orders JSON zstd-11 gives 32424 bytes at 23 MB/s and brotli-9 gives 32361 bytes at 13.1 MB/s: 63 bytes apart, zstd 1.76× faster. Brotli's walk from 9 to 11 buys another 14% for 44× the time, and zstd from 19 to 22 saves 8 bytes. The cliff is not a brotli flaw — it is the shape of entropy coding, and the only question is which rung you jump off.