isal-rs
Rust bindings for isa-l
Supports the following codecs using the ISA-L library under the hood:
- GZIP
isal::read::GzipEncoder/GzipDecoderisal::write::GzipEncoder/GzipDecoder
- DEFLATE
isal::read::DeflateEncoder/DeflateDecoderisal::write::DeflateEncoder/DeflateDecoder
- ZLIB
isal::read::ZlibEncoder/ZlibDecoderisal::write::ZlibEncoder/ZlibDecoder
Or can use functions of de/compress and de/compress_into
Building requires some system tools like autotools, nasm, make, and anything the official ISA-L repo suggests.
On Windows the build is invoked with nmake, other systems use the ./autogen.sh and ./configure setups.
Examples:
Functions like compress_into and decompress
(Similar functionality with compress and decompress_into)
use ;
let mut compressed = vec!;
let nbytes = compress_into.unwrap;
let decompressed = decompress.unwrap;
assert_eq!;
Compress using the Encoder/Decoder structs implementing io::Read
use ;
use ;
let data = b"Hello, World!".to_vec;
// Note these two encoders are equivelent...
let mut encoder = new;
let mut encoder = new;
// Number of compressed bytes written to `output`
let mut compressed = vec!;
let n = copy.unwrap;
assert_eq!;
let decompressed = decompress.unwrap;
assert_eq!;
Decompress using the Encoder/Decoder structs implementing io::Write
use ;
use ;
let data = b"Hello, World!".to_vec;
let compressed = compress.unwrap;
let mut decompressed = vec!;
let mut decoder = new;
// Number of compressed bytes written to `output`
let n = copy.unwrap;
assert_eq!;
assert_eq!;
Benchmarks
TL/DR: It's roughly 5-10x faster on average than the default settings with flate2.
Checkout the README in the benches directory. Criterion benchmark report available here: https://milesgranger.github.io/isal-rs/benches/criterion/report/
Versioning:
Versions are specified in normal SemVer format, and a trailing "+<< commit hash >>" to indicate
which commit in isa-l the crate is built against. ie: 0.1.0+62519d9