---
title: COMPRESSION_LZMESH
framework: compression
role: symbol
role_heading: Global Variable
path: compression/compression_lzmesh
---

# COMPRESSION_LZMESH

The LZMESH compression algorithm, which is recommended for fast, general-purpose compression on Apple platforms.

## Declaration

```swift
var COMPRESSION_LZMESH: compression_algorithm { get }
```

## Discussion

Discussion LZMESH is the Apple general-purpose compression algorithm, designed to replace both COMPRESSION_LZFSE and COMPRESSION_ZLIB across Apple platforms. It combines LZ77 with length-limited Huffman coding and a lazy match parser to deliver better compression ratio than both COMPRESSION_LZFSE and COMPRESSION_ZLIB while encoding significantly faster than either. LZMESH decodes 3.5x faster than COMPRESSION_ZLIB on Apple silicon. An LZMESH-encoded buffer is a sequence of blocks terminated by an end-of-stream marker. There are three block types: Each compressed block includes a footer that records block encoding parameters. Both headers and footers reserve flag bits for future format extensions. LZMESH is available through the buffer API only — compression_encode_buffer(_:_:_:_:_:_:) and compression_decode_buffer(_:_:_:_:_:_:). The decoder requires only 64 KB of scratch memory, making it well suited for memory-constrained environments. note: The COMPRESSION_LZMESH algorithm is available in version 27 or later of Apple operating systems.

## See Also

### Algorithm Constants

- [COMPRESSION_LZFSE](compression/compression_lzfse.md)
- [COMPRESSION_LZ4](compression/compression_lz4.md)
- [COMPRESSION_LZ4_RAW](compression/compression_lz4_raw.md)
- [COMPRESSION_LZMA](compression/compression_lzma.md)
- [COMPRESSION_ZLIB](compression/compression_zlib.md)
- [COMPRESSION_BROTLI](compression/compression_brotli.md)
- [COMPRESSION_LZBITMAP](compression/compression_lzbitmap.md)
- [COMPRESSION_LZRAVEN](compression/compression_lzraven.md)
