Zlib-rs as a Rust programming language implementation of the Zlib file format for better safety is now beginning to outperform the C implementations of the widely-used Zlib.
Zlib-rs 0.4.2 was released last week and notes in the release announcement:
“Lots of performance improvements. We’re now substantially faster than other implementations for inflate (decompression), and faster in the most important cases for compression.”
The Trifecta Tech Foundation that develops Zlib-rs also put out a lengthy blog post today that outlines the performance improvements over Zlib C implementations, including both zlib-ng and the Chromium zlib implementation.
Some takeaways from that blog post entitled “zlib-rs is faster than C”:
“As far as we know, we’re the fastest api-compatible zlib implementation today for decompression. Not only do we beat zlib-ng by a fair margin, we’re also faster than the implementation used in chromium.
…
We’re now significantly faster than zlib-ng for all but the smallest chunk size. A chunk size of 2^4 = 16 bytes is very unlikely to be relevant for performance in practice because the input can just be buffered and then decompressed in larger chunks.We are however significantly faster than zlib-ng at the more relevant chunk sizes: well over 10% for inputs of 1kb, and over 6% for inputs of 65kb.
…
For decompression, the zlib implementation used in the chromium project (found here, which we use via a modified version of libz-sys) is often faster than zlib-ng. However, we also beat it at this benchmark for the most relevant chunk sizes.
We’ve been chipping away at compression too (shoutout to Brian Pane, who contributed numerous PRs in this area), but see more mixed results.”
Some impressive results and promising outlook for Zlib-rs while continuing to retain Zlib API compatibility. The project is hoping to raise €95k in funding to complete additional performance and packaging work.