---
title: COMPRESSION_LZFSE
framework: compression
role: symbol
role_heading: Global Variable
path: compression/compression_lzfse
---

# COMPRESSION_LZFSE

The LZFSE compression algorithm, which is recommended for use on Apple platforms.

## Declaration

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

## Discussion

Discussion LZFSE is the Apple proprietary, general-purpose compression algorithm. It pairs an LZ77-style match finder with Finite State Entropy (FSE, a variant of tabled Asymmetric Numeral Systems) to encode literals and match metadata, which lets it match the compression ratio of COMPRESSION_ZLIB (zlib level 5) while running 2x to 3x faster for both encoding and decoding. LZFSE is also substantially more energy-efficient than COMPRESSION_ZLIB, which makes it a good default for mobile and battery-powered devices. LZFSE sits at a balanced point in the speed-ratio tradeoff: it compresses better than COMPRESSION_LZ4 and runs faster than COMPRESSION_ZLIB or COMPRESSION_LZMA, but doesn’t match the ratio of COMPRESSION_LZMA or the raw throughput of COMPRESSION_LZ4. For new Apple-only code, prefer COMPRESSION_LZMESH — it typically compresses a bit better than LZFSE, encodes significantly faster, and decodes slightly faster. If a payload needs to be decoded on another platform such as Linux or Windows, use COMPRESSION_LZ4, COMPRESSION_LZMA, or COMPRESSION_ZLIB instead. Apple does publish an open-source LZFSE reference implementation, but it isn’t as widely available as COMPRESSION_ZLIB or COMPRESSION_LZMA. LZFSE is supported by both the buffer API — compression_encode_buffer(_:_:_:_:_:_:) and compression_decode_buffer(_:_:_:_:_:_:) — and the streaming API via compression_stream_init(_:_:_:), so you can use it for in-memory payloads or for processing data incrementally as it arrives.

## See Also

### Algorithm Constants

- [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_LZMESH](compression/compression_lzmesh.md)
- [COMPRESSION_LZRAVEN](compression/compression_lzraven.md)
