pub enum CompressionLevel {
Uncompressed,
Fastest,
Default,
Better,
Best,
}Expand description
The compression mode used impacts the speed of compression, and resulting compression ratios. Faster compression will result in worse compression ratios, and vice versa.
Variants§
Uncompressed
This level does not compress the data at all, and simply wraps it in a Zstandard frame.
Fastest
This level is roughly equivalent to Zstd compression level 1
Default
This level uses the crate’s dedicated dfast-style matcher to
target a better speed/ratio tradeoff than CompressionLevel::Fastest.
It represents this crate’s “default” compression setting and may evolve in future versions as the implementation moves closer to reference zstd level 3 behavior.
Better
This level is roughly equivalent to Zstd level 7.
Uses the hash-chain matcher with a lazy2 matching strategy: the encoder
evaluates up to two positions ahead before committing to a match,
trading speed for a better compression ratio than CompressionLevel::Default.
Limitation: hash-chain tables use 32-bit positions. For single-frame
inputs exceeding ~4 GiB, matches can still be found for roughly one
window past that point; once all in-window positions exceed u32::MAX
(≈4 GiB + window size), matching becomes effectively repcode-only.
Prefer CompressionLevel::Default for very large single-frame streams
until table rebasing is implemented.
Best
This level is roughly equivalent to Zstd level 11.
Uses the hash-chain matcher with a deep lazy2 matching strategy and
a 16 MiB window. Compared to CompressionLevel::Better, this level
uses larger hash and chain tables (2 M / 1 M entries vs 1 M / 512 K),
a deeper search (32 candidates vs 16), and a higher target match
length (128 vs 48), trading speed for the best compression ratio
available in this crate.
Limitation: hash-chain tables use 32-bit positions. For single-frame
inputs exceeding ~4 GiB, matches can still be found for roughly one
window past that point; once all in-window positions exceed u32::MAX
(≈4 GiB + window size), matching becomes effectively repcode-only.
Prefer CompressionLevel::Default for very large single-frame
streams until table rebasing is implemented.
Trait Implementations§
Source§impl Clone for CompressionLevel
impl Clone for CompressionLevel
Source§fn clone(&self) -> CompressionLevel
fn clone(&self) -> CompressionLevel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more