pub struct CompressorConfig {
    pub compression_level: usize,
    pub delta_encoding_order: usize,
}
Expand description

All the settings you can specify about compression.

Some, like delta_encoding_order, are explicitly stored as Flags in the compressed bytes. Others, like compression_level, affect compression but are not explicitly stored in the output.

Fields

compression_level: usize

compression_level ranges from 0 to 12 inclusive, defaulting to 6.

The compressor uses up to 2^compression_level prefixes.

For example,

  • Level 0 achieves a modest amount of compression with 1 prefix and can be twice as fast as level 6.
  • Level 6 achieves nearly the best compression with 64 prefixes and still runs in reasonable time. In some cases, its compression ratio is 3-4x as high as level level 0’s.
  • Level 12 can achieve a few % better compression than 6 with 4096 prefixes but runs ~10x slower in many cases.
delta_encoding_order: usize

delta_encoding_order ranges from 0 to 7 inclusive, defaulting to 0.

It is the number of times to apply delta encoding before compressing. For instance, say we have the numbers [0, 2, 2, 4, 4, 6, 6] and consider different delta encoding orders.

  • 0 indicates no delta encoding, it compresses numbers as-is. This is perfect for columnar data were the order is essentially random.
  • 1st order delta encoding takes consecutive differences, leaving [0, 2, 0, 2, 0, 2, 0]. This is perfect for continuous but noisy time series data, like stock prices.
  • 2nd order delta encoding takes consecutive differences again, leaving [2, -2, 2, -2, 2, -2]. This is perfect for locally linear data, like a sequence of timestamps sampled approximately periodically.
  • Higher-order delta encoding is good for time series that are very smooth, like temperature or light sensor readings.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.