

In the stream compressor department, the benchmark covers the following crates: DEFLATE/ zlibĭEFLATE is an older algorithm that uses a dictionary and Huffman encoding. For now, I have marked the respective libraries with an asterisk (*). This may mean my implementation of the benchmark is faulty, or it may be a fault in the library. Note : Some of the compressors failed the roundtrip test, which means the compressed and then uncompressed data failed to match the original.
FILE MINIMIZER ALGORITHM FULL
Click here to see the full demo with network requests My machine has a Ryzen 3550H four-core CPU running Linux 5.8.18_1.
FILE MINIMIZER ALGORITHM MOVIE

A 100MB file of zeroes created with cat /dev/zero | head -c $ > zeros.bin.We’ll focus only on lossless compression - no image, audio or video-related lossy compression formats.įor a somewhat realistic benchmark, I’ll use the following files to compress and decompress, ranging from very compressible to very hard to compress: compression ratio, the capability to stream data, and safety measures such as checksums. Like any problem, there are myriad solutions that have different trade-offs in terms of runtime for compression and decompression, CPU and memory use vs. What are the best compression libraries for Rust? Some clients also allow for bzip2 compression, but this isn’t as widespread anymore since gzip can be made to get similar compression ratio with Zopfli (trading compression time), and you could use Brotli to go even smaller. I list gzip and deflate under the same title because they implement the same underlying algorithm, and gzip adds more checks and header information. zip) can both collect and compress files.įor the web, there are only two stream formats that have achieved widespread implementation: gzip/ deflate and Brotli. An archiver enables you to serialize multiple files and directories. A stream compressor takes a stream of bytes and emits a shorter stream of compressed bytes. There are two variants of compression utilities: stream compressors and archivers.
FILE MINIMIZER ALGORITHM RAR
Archiving libraries for Rust: tar, zip, and rar.Stream compression libraries for Rust: DEFLATE/ zlib, Snappy, LZ4, ZStandard, LZMA, Zopfli, and Brotli.What are the best compression libraries for Rust?.Here’s hoping most will be ported to Rust soon. For some formats, all we have are thin wrappers around C libraries. Unlike my review of Rust serialization libraries, it doesn’t make sense to compare performance between different formats.

Fortunately, the Rust community has a number of crates to deal with this. 8, 2021 to correct errors in the original benchmark.ĭata compression is an important component in many applications. Rust compression librariesĮditor’s note: This post was updated on Jan. He enjoys learning new things and telling others about them. A musician-turned-programmer, he has worked in many fields, from voice acting and teaching, to programming and managing software projects. Andre Bogus Follow Andre "llogiq" Bogus is a Rust contributor and Clippy maintainer.
