BT

InfoQ Homepage News Apple Open-Sources its New Compression Algorithm LZFSE

Apple Open-Sources its New Compression Algorithm LZFSE

Leia em português

Bookmarks

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
Style

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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.