5.3.1. Compile Time Tuning - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

Compile time tuning is available through CMake options.

Do not compile the library targeted for performance with the AOCL_ENABLE_LOG_FEATURE option.

Following options are available to enable/disable specific optimizations in respective compression methods:

Flag

Description

Use case

AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT1 (LZ4)
AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT2 (LZ4)
SNAPPY_MATCH_SKIP_OPT (Snappy)
AOCL_ZSTD_SEARCH_SKIP_OPT (ZSTD)

If matches are not found for N number of bytes when parsing input data, increase the parsing step size from 1 to M and look for matches at these points only. This provides faster compression in scenarios where it is hard to find matches at the expense of compression ratio.

AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT2 does more aggressive skipping that AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT1 for LZ4.
[Values: ON / OFF, Defaults: AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT1 (OFF) AOCL_LZ4_MATCH_SKIP_OPT _LDS_STRAT2 (OFF) SNAPPY_MATCH_SKIP_OPT (ON) AOCL_ZSTD_SEARCH_SKIP_OPT (ON)]

Files that are hard to compress

AOCL_LZ4_NEW_PRIME _NUMBER (LZ4)
AOCL_LZ4_EXTRA_HASH _TABLE_UPDATES (LZ4)
AOCL_LZ4_HASH_BITS_USED (LZ4)
SNAPPY_HIGH_COMPRESSION (Snappy)

A hash table is used to keep a dictionary of matches found in the past for different byte patterns in the input. In LZ4 multiplicative hashing function is used, which takes 5 bytes of input and multiplies it with a hard-coded prime number to get the hash. In Snappy, hash value is generated using the CRC32 algorithm.

AOCL_LZ4_NEW_PRIME _NUMBER: Alternate prime number found through empirical studies is used [Values: ON / OFF (default)]
AOCL_LZ4_EXTRA_HASH _TABLE_UPDATES: When a match of length N is found, the next comparison begins from src+N. Bytes that are skipped are not added to hash table by default. This flag inserts some of these skipped bytes into the hash table thus providing better compression. [Values: ON / OFF (default)]
AOCL_LZ4_HASH_BITS_USED: Use more than 5 bytes (40 bits) when computing hash. LOW: 41 bits, HIGH: 44 bits. [Values: LOW / HIGH (LOW by default)]
SNAPPY_HIGH_COMPRESSION: Hash table size is doubled if input size is more than 32 KB. [Values: ON / OFF (default)]
AOCL_LZ4_NEW_PRIME _NUMBER: Determine experimentally if it is useful for your data set
AOCL_LZ4_EXTRA_HASH _TABLE_UPDATES: Better compression desired
AOCL_LZ4_HASH_BITS_USED: Better speed desired
SNAPPY_HIGH_COMPRESSION: Better compression desired
AOCL_LZ4_OPT_PREFETCH _BACKWARDS (LZ4)

Prefetch match candidates in advance [Values: ON / OFF (default)]

Data with higher likelihood of finding matches

AOCL_LZ4HC_DISABLE _PATTERN_ANALYSIS (LZ4HC)

Disable fast code path to handle repeated byte patterns such as β€œ000000”. Faster compression when data does not have such patterns. [Values: ON (default) / OFF]

Enable if data contains such patterns

ENABLE_FAST_MATH

Enable fast math optimizations [Values: ON / OFF (default)]

Enable if application is not sensitive to floating-point numerical accuracy

SNAPPY_ENABLE _DECOMPRESS_BRANCHLESS (Snappy)

Enable Snappy branchless decompression optimization. [Values: ON / OFF (default value: ON for non-GCC and OFF for GCC compiler)]

For non-GCC compilers, disable this option if performance is less when compared to with this option.

AOCL_COMPRESS_FAST (ZSTD)

Enable fast compression modes that might compromise on compression ratio but provide faster compression.

Supported values: ZSTD (levels 1-3).
Disabled by default.

Faster compression speed desired while accepting lower compression ratio.

AOCL_ZSTD_DYN_BLOCK_SIZE (ZSTD)

Enable ZSTD dynamic block size determination. [Values: ON / OFF (default)]

Enable in order to improve compressibility.

AOCL_BZIP2_HUFFMAN _ITERATIONS (BZIP2)

Control number of BZIP2 Huffman tables refinement iterations.

Supported values: levels 1-4, default value is 3.

Lower values are faster but reduce compression ratio.

AOCL_DECOMPRESS_FAST (LZ4, ZSTD & SNAPPY)

Enable fast decompression modes that might compromise on compression speed / ratio to produce streams that decompress faster.

Supported values: ZSTD (levels 1-3), Snappy (levels 1-2), and LZ4 (level 1).
Disabled by default.

Applications with focus on faster decompression speeds.

E.g.: Applications that compress once, decompress multiple times.