[][src]Enum zstd::stream::raw::CParameter

pub enum CParameter {
    Format(FrameFormat),
    CompressionLevel(i32),
    WindowLog(u32),
    HashLog(u32),
    ChainLog(u32),
    SearchLog(u32),
    MinMatch(u32),
    TargetLength(u32),
    Strategy(ZSTD_strategy),
    EnableLongDistanceMatching(bool),
    LdmHashLog(u32),
    LdmMinMatch(u32),
    LdmBucketSizeLog(u32),
    LdmHashRateLog(u32),
    ContentSizeFlag(bool),
    ChecksumFlag(bool),
    DictIdFlag(bool),
    NbWorkers(u32),
    JobSize(u32),
    OverlapSizeLog(u32),
}

Variants

Format(FrameFormat)

See FrameFormat.

CompressionLevel(i32)

Update all compression parameters according to pre-defined cLevel table.

Default level is ZSTD_CLEVEL_DEFAULT==3.

Special: value 0 means "do not change cLevel".

WindowLog(u32)

Maximum allowed back-reference distance, expressed as power of 2.

Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.

Special: value 0 means "do not change windowLog".

Note: Using a window size greater than ZSTD_MAXWINDOWSIZE_DEFAULT (default: 2^27) requires setting the maximum window size at least as large during decompression.

HashLog(u32)

Size of the probe table, as a power of 2.

Resulting table size is (1 << (hashLog+2)). Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.

Larger tables improve compression ratio of strategies <= dFast, and improve speed of strategies > dFast.

Special: value 0 means "do not change hashLog".

ChainLog(u32)

Size of the full-search table, as a power of 2.

Resulting table size is (1 << (chainLog+2)). Larger tables result in better and slower compression. This parameter is useless when using "fast" strategy.

Special: value 0 means "do not change chainLog".

SearchLog(u32)

Number of search attempts, as a power of 2.

More attempts result in better and slower compression. This parameter is useless when using "fast" and "dFast" strategies.

Special: value 0 means "do not change searchLog".

MinMatch(u32)

Minimum size of searched matches (note : repCode matches can be smaller).

Larger values make faster compression and decompression, but decrease ratio. Must be clamped between ZSTD_SEARCHLENGTH_MIN and ZSTD_SEARCHLENGTH_MAX.

Note that currently, for all strategies < btopt, effective minimum is 4.

Note that currently, for all strategies > fast, effective maximum is 6.

Special: value 0 means "do not change minMatchLength".

TargetLength(u32)

Only useful for strategies >= btopt.

Length of Match considered "good enough" to stop search. Larger values make compression stronger and slower.

Special: value 0 means "do not change targetLength".

Strategy(ZSTD_strategy)

Compression strategy. Affects compression ratio and speed.

EnableLongDistanceMatching(bool)

Enables long distance matching to improve compression ratio for large inputs.

Increases memory usage and window size.

LdmHashLog(u32)

Size of the table for long distance matching, as a power of 2.

Larger values increase memory usage and compression ratio, but decrease compression speed. Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX

Default: windowlog - 7.

Special: value 0 means "automatically determine hashlog".

LdmMinMatch(u32)

Minimum match size for long distance matcher.

Larger/too small values usually decrease compression ratio.

Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.

Special: value 0 means "use default value" (default: 64).

LdmBucketSizeLog(u32)

Log size of each bucket in the LDM hash table for collision resolution.

Larger values improve collision resolution but decrease compression speed. The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.

Special: value 0 means "use default value" (default: 3).

LdmHashRateLog(u32)

Frequency of inserting/looking up entries into the LDM hash table.

Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN). Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage. Larger values improve compression speed.

Deviating far from default value will likely result in a compression ratio decrease.

Special: value 0 means "automatically determine hashRateLog".

ContentSizeFlag(bool)

Content size will be written into frame header whenever known (default:1)

Content size must be known at the beginning of compression, it is provided using ZSTD_CCtx_setPledgedSrcSize()

ChecksumFlag(bool)

A 32-bits checksum of content is written at end of frame (default:0)

DictIdFlag(bool)

When applicable, dictionary's ID is written into frame header (default:1)

NbWorkers(u32)

Select how many threads will be spawned to compress in parallel.

When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() : ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller, while compression work is performed in parallel, within worker threads.

(note : a strong exception to this rule is when first invocation of ZSTD_compressStream2() sets ZSTD_e_end : in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).

More workers improve speed, but also increase memory usage.

Default value is 0, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking.

JobSize(u32)

Size of a compression job. This value is enforced only when nbWorkers >= 1.

Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.

0 means default, which is dynamically determined based on compression parameters.

Job size must be a minimum of overlap size, or 1 MB, whichever is largest.

The minimum size is automatically and transparently enforced

OverlapSizeLog(u32)

Control the overlap size, as a fraction of window size.

The overlap size is an amount of data reloaded from previous job at the beginning of a new job.

It helps preserve compression ratio, while each job is compressed in parallel.

This value is enforced only when nbWorkers >= 1.

Larger values increase compression ratio, but decrease speed.

Possible values range from 0 to 9 :

  • 0 means "default" : value will be determined by the library, depending on strategy
  • 1 means "no overlap"
  • 9 means "full overlap", using a full window size.

Each intermediate rank increases/decreases load size by a factor 2 : 9: full window; 8: w/2; 7: w/4; 6: w/8; 5:w/16; 4: w/32; 3:w/64; 2:w/128; 1:no overlap; 0:default

default value varies between 6 and 9, depending on strategy.

Trait Implementations

impl StructuralPartialEq for CParameter[src]

impl PartialEq<CParameter> for CParameter[src]

impl StructuralEq for CParameter[src]

impl Eq for CParameter[src]

impl Debug for CParameter[src]

impl Copy for CParameter[src]

impl Clone for CParameter[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]