<!--
{
  "availability" : [
    "Mac Catalyst: 27.0.0 -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Compression",
  "identifier" : "/documentation/Compression/COMPRESSION_LZRAVEN",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Compression"
    ],
    "preciseIdentifier" : "c:@EA@compression_algorithm@COMPRESSION_LZRAVEN"
  },
  "title" : "COMPRESSION_LZRAVEN"
}
-->

# COMPRESSION_LZRAVEN

The LZRAVEN compression algorithm, which is recommended for high-compression ratio with fast decoding on Apple platforms.

```
var COMPRESSION_LZRAVEN: compression_algorithm { get }
```

## Discussion

LZRAVEN is the Apple high-compression algorithm, designed to replace [`COMPRESSION_LZMA`](/documentation/Compression/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`](/documentation/Compression/COMPRESSION_LZMA). LZRAVEN uses an 8 MB dictionary and encodes faster than [`COMPRESSION_LZMA`](/documentation/Compression/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`](/documentation/Compression/COMPRESSION_LZMA) decode speed would be prohibitive.

LZRAVEN is available through the buffer API only — [`compression_encode_buffer(_:_:_:_:_:_:)`](/documentation/Compression/compression_encode_buffer(_:_:_:_:_:_:)) and [`compression_decode_buffer(_:_:_:_:_:_:)`](/documentation/Compression/compression_decode_buffer(_:_:_:_:_:_:)).

The decoder requires approximately 36 KB of scratch memory, making it well suited for memory-constrained environments.

> Note: The `COMPRESSION_LZRAVEN` algorithm is available in version 27 or later of Apple operating systems.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)