Apple's new open-source lossless compression algorithmLZFSEThe algorithm is iOS 9 and OS X 10.10 in the last yearIntroducedof. According to Apple's argument, LZFE compression gain 5 are the same and ZLib level, but faster 2 to 3 times higher energy efficiency.
LZFSE based on Lempel-Ziv, and the use ofFinite state entropy coding, Which is based in Jarek DudaAsymmetric Digital Systems(ANS) done by entropy coding. Simply put, ANS designed to & ldquo; End of speed ratios and balance & rdquo ;, both for accurate coding, coding and can be used to quickly and has a data encryption feature. Instead of the more traditional use of ANSHuffman andArithmetic CodingThe method of compression librarymore and more, LZFSE it among them.
Obviously, LZFSE not aim to be the best or the fastest algorithm. In fact, Apple has stated thatLZ4Compression speed faster than LZFSE, andLZMA It provides a higher compression ratio, but at the cost of other options than Apple SDK provides an order of magnitude slower. When the compression ratio and speed is almost as important, and you want to reduce the energy efficiency when, LZFSE Apple recommended option.
GitHub Providing LZFSE the reference implementation. Build and run on MacOS as simple as:
$ Xcodebuild install DSTROOT = / tmp / lzfse.dst
If you want to build LZFSE for the current iOS devices, you can do:
xcodebuild -configuration "Release" -arch armv7 install DSTROOT = / tmp / lzfse.dst
apart from API documentationAddition, Apple last year also provided aExample project, Shows how to use LZFSE the block and stream compression, which is a practical LZFSE resources for getting started.
LZFSE in Googlebrotli After the release of the latter in the open source last year. Compared with LZFSE, brotliIt seems to be for a different application scenarios optimized, Static Web assets such as compression and Android APK, in these cases, is the most important compression ratio.