Apple Open-Sources its New Compression Algorithm LZFSE

| by Sergio De Simone Follow 7 Followers on Jul 02, 2016. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Apple has open-sourced its new lossless compression algorithm, LZFSE, introduced last year with iOS 9 and OS X 10.10. According to Apple, LZFE provides the same compression gain as ZLib level 5 while being 2x–3x faster and with higher energy efficiency.

LZFSE is based on Lempel-Ziv and uses Finite State Entropy coding, based on Jarek Duda’s work on Asymmetric Numeral Systems (ANS) for entropy coding. Shortly, ANS aims to “end the trade-off between speed and rate” and can be used both for precise coding and very fast encoding, with support for data encryption. LZFSE is one of a growing number of compression libraries that use ANS in place of the more traditional Huffman and arithmetic coding.

Admittedly, LZFSE does not aim to be the best or fastest algorithm out there. In fact, Apple states that LZ4 is faster than LZFSE while LZMA provides a higher compression ratio, albeit at the cost of being an order of magnitude slower than other options available in Apple SDKs. LZFSE is Apple’s suggested option when compression and speed are more or less equally important and you want reduce energy consumption.

LZFSE reference implementation is available on GitHub. Building on macOS is as easy as executing:

$ xcodebuild install DSTROOT=/tmp/lzfse.dst

If you want to build LZFSE for a current iOS device, you can execute:

xcodebuild -configuration "Release" -arch armv7 install DSTROOT=/tmp/lzfse.dst

Besides its API documentation, a useful resource to start using LZFSE is a sample project that Apple made available last year to show how to use LZFSE both for block and stream compression.

LZFSE follows on Google’s brotli, which was open sourced last year. In comparison to LZFSE, brotli seems to be tuned for a different use case, such as compressing static Web assets and Android APKs, where compression rates are of prime importance.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you