Compression module · live benchmark
Compare codec paths on the machine that will run them.
These browser benchmarks put native compression and decompression, compact JavaScript codecs, and injected backends against the same bytes. Results are useful for choosing a path, not for claiming a universal ranking.
Read the result carefully
Benchmark the boundary you actually care about.
Warm-up, browser support, bundle size, and output verification all matter alongside throughput. Run the same format and payload when comparing implementations.
Throughput
Measured on the uncompressed fixture bytes
Correctness
Every row is checked against expected output
Native
Shown as N/A when the browser lacks support
Bundle
Approximate browser payload indicator
Detailed guide
Run the benchmark
The interactive app below runs the comparison in this browser. Notes underneath define fixtures, warm-up, backend coverage, and known platform variation.
These live browser benchmarks compare built-in compression and decompression with the
compact or injected codec paths used by @loaders.gl/compression.
This page is part of the @loaders.gl/compression module documentation.
Loading compression benchmarks...
Notes
- Covers GZIP, DEFLATE, Brotli, Snappy, LZ4, bzip2, XZ, and Zstandard.
generated.csvrows use deterministic generated CSV; each implementation receives the same compressed bytes for that format.- bzip2 and XZ use the same CSV payload as the other formats; their fixtures are compressed before timing.
- Each timed decompression operation processes the complete buffer and is checked against the expected uncompressed byte count.
- Throughput is measured in bytes per second after warm-up, using the uncompressed fixture size as the multiplier.
- Native rows show
N/Awhen this browser lacks the requiredCompressionStreamorDecompressionStreamformat for that table. - Bundle sizes are approximate browser payload indicators, not
node_modulessizes or exact emitted bundle measurements. - Every available
compress-utilsformat is compared through its publicformat-libraryadapter. - Native Zstandard support in Chrome is tracked by Chromium issue 40196713.
- Results vary with browser, hardware, thermal state, and tab focus.
Internal engine baseline
GZIP and DEFLATE compare the internal fflate 0.7.4 fork with the original npm implementation on identical compressed input, alongside native, Pako and WASM backends. Every implementation is verified byte-for-byte before timing; timed iterations check output length. Keep the tab focused and repeat runs before judging small differences. These rows measure warm whole-buffer decoding, not cold import latency, peak memory, or streaming throughput.
Run the hermetic encode/decode baseline with yarn bench compression or
yarn bench-headless compression. Group labels include input and compressed
byte counts; gzip timestamps are fixed for reproducibility.
For cold imports and bundle/memory baselines, run
node scripts/measure-compression-engine.mjs. It emits one JSON record per
implementation, using equivalent minified browser ESM bundles and a fresh Node
process for each engine. Import time excludes process startup. Peak RSS includes
the Node runtime, module initialization, fixture allocation, and one verified
encode/decode per format; it is a process footprint, not isolated codec heap
usage. Bundle bytes cover the six whole-buffer functions, excluding stream
classes and loaders.gl adapters. Repeat this command before comparing timings.
Both the 70,937-byte and 16 MiB payloads are generated in memory with a fixed seed. Records are shuffled in batches and contain varied numbers, timestamps, random tokens, categorical fields, and variable-length descriptions. The large payload is generated independently rather than repeating the small buffer. Generation and fixture compression run before timing, and every decoder receives identical compressed bytes for a format. No generated fixtures are stored in the repository. Rates use actual processed bytes and elapsed time; the small result is never extrapolated to the large size.
Compression throughput
The compression table measures encoding alone for the same 70 KB and 16 MiB payloads. Every encoder is round-trip verified before timing. Large encoding cases use three serial, single-operation samples to keep expensive encoders from running an automatically expanded iteration batch. Timed iterations check that an output is produced; decoding is outside the timed callback. Encoder-only implementations are listed where available, including compress-utils for all eight formats. Native compression support is probed independently of decompression. Encoders use their defaults, except Brotli uses level 4 and fflate gzip uses a fixed timestamp; these are throughput comparisons, not equal-quality or equal-ratio comparisons.
zstd-codec 0.1.5 whole-buffer encoding exhausts its WASM heap at 16 MiB, so that encoder is measured only for the small payload and its large result shows N/A. Its large decompression benchmark remains available; compress-utils encoding covers both sizes.