#zlib #simd #gzip

cloudflare-zlib

Safe wrapper for Cloudflare's optimized zlib

5 releases

0.2.10 Oct 14, 2023
0.2.9 Apr 23, 2021
0.2.5 Aug 23, 2019
0.2.2 Jan 21, 2019
0.2.1 Nov 24, 2018

#74 in Compression

Download history 950/week @ 2024-07-21 542/week @ 2024-07-28 1255/week @ 2024-08-04 1115/week @ 2024-08-11 919/week @ 2024-08-18 1035/week @ 2024-08-25 843/week @ 2024-09-01 999/week @ 2024-09-08 616/week @ 2024-09-15 1169/week @ 2024-09-22 594/week @ 2024-09-29 525/week @ 2024-10-06 508/week @ 2024-10-13 833/week @ 2024-10-20 585/week @ 2024-10-27 797/week @ 2024-11-03

2,762 downloads per month
Used in 6 crates (2 directly)

MIT AND Zlib OR Apache-2.0 AND Zlib

17KB
270 lines

Cf-Zlib

This is a Rust wrapper for Cloudflare's SIMD-accelerated fork of zlib.

It requires x86-64 CPU with SSE 4.2 or ARM64 with NEON & CRC. It does not support 32-bit CPUs at all.

Note: you will have to ensure that the program using cloudflare-zlib does not link with any other version of libz. Otherwise the accelerated version may not be used, or the program could even crash. Because of a Cargo issue this crate doesn't prevent this problem.

ARM

If arm-always feature is set (build with --features=arm-always), ARM will be supported without a runtime check (i.e. it will crash if run on an unsupported ARM CPU). Otherwise it will fail gracefully on an incompatible CPU.

Example

use cloudflare_zlib::*;

let mut stream = Deflate::new(Z_BEST_COMPRESSION, Z_DEFAULT_STRATEGY, 15)?;
stream.compress(b"lorem")?;
stream.compress(b" ipsum")?;
let compressed = stream.finish()?;

Licenses

Zlib

(C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly jloup@gzip.org Mark Adler madler@alumni.caltech.edu

If you use the zlib library in a product, we would appreciate not receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code.

If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions.

libz-sys

This project is licensed under either of

at your option.

Dependencies

~360–640KB
~13K SLoC