COMPRESSION_LZRAVEN
The LZRAVEN compression algorithm, which is recommended for high-compression ratio with fast decoding on Apple platforms.
Declaration
var COMPRESSION_LZRAVEN: compression_algorithm { get }Discussion
LZRAVEN is the Apple high-compression algorithm, designed to replace COMPRESSION_LZMA across Apple platforms. It combines LZ77 with modern entropy coding, adaptive context-sensitive modeling, and near-optimal parsing to often achieve a slightly better compression ratio than COMPRESSION_LZMA. LZRAVEN uses an 8 MB dictionary and encodes faster than COMPRESSION_LZMA while decoding 3x faster on Apple silicon, where the decoder leverages vector units to process multiple symbols per operation.
An LZRAVEN-encoded buffer begins with a stream header that encodes global encoder parameters, defines the quantized size of the LZ dictionary, and provides reserved feature flags for future extensions. The stream header is followed by a sequence of compressed or uncompressed blocks that are terminated by an empty block.
Each block begins with a header that encodes the block’s compressed size and feature flags. A block can be either compressed or stored uncompressed when compression would provide no benefit. LZRAVEN is practical for latency-sensitive workloads where COMPRESSION_LZMA decode speed would be prohibitive.
LZRAVEN is available through the buffer API only — compression_encode_buffer(_:_:_:_:_:_:) and compression_decode_buffer(_:_:_:_:_:_:).
The decoder requires approximately 36 KB of scratch memory, making it well suited for memory-constrained environments.