Skip to main content
Zstandard delivers exceptional compression performance across different speed and ratio targets. The benchmarks below demonstrate its performance characteristics compared to other popular compression algorithms.

Benchmark Setup

For reference, several fast compression algorithms were tested and compared on a desktop featuring a Core i7-9700K CPU @ 4.9GHz and running Ubuntu 24.04 (Linux 6.8.0-53-generic), using lzbench, an open-source in-memory benchmark by @inikep compiled with gcc 14.2.0, on the Silesia compression corpus.

Compression Speed Comparison

Compressor nameRatioCompressionDecompress.
zstd 1.5.7 -12.896510 MB/s1550 MB/s
brotli 1.1.0 -12.883290 MB/s425 MB/s
zlib 1.3.1 -12.743105 MB/s390 MB/s
zstd 1.5.7 —fast=12.439545 MB/s1850 MB/s
quicklz 1.5.0 -12.238520 MB/s750 MB/s
zstd 1.5.7 —fast=42.146665 MB/s2050 MB/s
lzo1x 2.10 -12.106650 MB/s780 MB/s
lz4 1.10.02.101675 MB/s3850 MB/s
snappy 1.2.12.089520 MB/s1500 MB/s
lzf 3.6 -12.077410 MB/s820 MB/s
The negative compression levels, specified with --fast=#, offer faster compression and decompression speed at the cost of compression ratio.

Speed vs Compression Trade-off

Zstandard can also offer stronger compression ratios at the cost of compression speed. Speed vs Compression trade-off is configurable by small increments. Decompression speed is preserved and remains roughly the same at all settings, a property shared by most LZ compression algorithms, such as zlib or lzma. The following tests were run on a server running Linux Debian (Linux version 4.14.0-3-amd64) with a Core i7-6700K CPU @ 4.0GHz, using lzbench, an open-source in-memory benchmark by @inikep compiled with gcc 7.3.0, on the Silesia compression corpus.

Compression Speed vs Ratio

Compression Speed vs Ratio

Decompression Speed

Decompression Speed A few other algorithms can produce higher compression ratios at slower speeds, falling outside of the graph. For a larger picture including slow modes, click here.

Small Data Compression

Previous charts provide results applicable to typical file and stream scenarios (several MB). Small data comes with different perspectives. The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no “past” to build upon. To solve this situation, Zstd offers a training mode, which can be used to tune the algorithm for a selected type of data. Training Zstandard is achieved by providing it with a few samples (one file per sample). The result of this training is stored in a file called “dictionary”, which must be loaded before compression and decompression. Using this dictionary, the compression ratio achievable on small data improves dramatically. The following example uses the github-users sample set, created from github public API. It consists of roughly 10K records weighing about 1KB each.

Compression Ratio

Compression Ratio

Compression Speed

Compression Speed

Decompression Speed

Decompression Speed These compression gains are achieved while simultaneously providing faster compression and decompression speeds. Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no universal dictionary). Hence, deploying one dictionary per type of data will provide the greatest benefits. Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file.

Dictionary Compression How To

  1. Create the dictionary
    zstd --train FullPathToTrainingSet/* -o dictionaryName
    
  2. Compress with dictionary
    zstd -D dictionaryName FILE
    
  3. Decompress with dictionary
    zstd -D dictionaryName --decompress FILE.zst
    

Build docs developers (and LLMs) love