LZ4 (compression algorithm)

From Wikipedia, the free encyclopedia

Template:Short description Template:DMCA

Page Module:Infobox/styles.css has no content.

LZ4
[[Programmer|Original authorTemplate:Pluralize from text]]Yann Collet
[[Programmer|DeveloperTemplate:Pluralize from text]]Yann Collet
Initial releaseScript error: No such module "Date time".
Template:Infobox software/simple
Written inC
Operating systemCross-platform
PlatformPortable
TypeData compression
LicenseSimplified BSD License
WebsiteLua error in package.lua at line 80: module 'Module:If preview' not found.

Script error: No such module "Check for conflicting parameters". Page Module:Infobox/styles.css has no content.

LZ4 Frame Format
Magic number04 22 4D 18 (new)
02 21 4C 18 (legacy)[1]
Type of formatData compression
Websitehttps://github.com/lz4/lz4/blob/master/doc/lz4_Frame_format.md

LZ4 is a lossless data compression algorithm optimized for fast compression and decompression. It belongs to the LZ77 family of byte-oriented compression schemes.

Features

The LZ4 algorithm provides a good trade-off between speed and compression ratio. Typically, it has a smaller (i.e., worse) compression ratio than the similar LZO algorithm, which in turn is worse than algorithms like DEFLATE. However, LZ4 compression speed is similar to LZO and several times faster than DEFLATE, while decompression speed is significantly faster than LZO.[2]

Design

LZ4 only uses a dictionary-matching stage (LZ77) and, unlike other common compression algorithms, does not combine it with an entropy coding stage (e.g. Huffman coding in DEFLATE).[3][4]

The LZ4 algorithm represents the data as a series of sequences. Each sequence begins with a one-byte token that is broken into two 4-bit fields. The first field represents the number of literal bytes that are to be copied to the output. The second field represents the number of bytes to copy from the already decoded output buffer (with 0 representing the minimum match length of 4 bytes). A value of 15 in either of the bitfields indicates that the length is larger and there is an extra byte of data that is to be added to the length. A value of 255 in these extra bytes indicates that yet another byte is to be added. Hence, arbitrary lengths are represented by a series of extra bytes containing the value 255. The string of literals comes after the token and any extra bytes needed to indicate string length. This is followed by an offset that indicates how far back in the output buffer to begin copying. The extra bytes (if any) of the match-length come at the end of the sequence.[5][6]

Compression can be carried out in a stream or in blocks. Higher compression ratios can be achieved by investing more effort in finding the best matches. This results in both a smaller output and faster decompression.

LZ4 has two frame formats. The legacy format was very restrictive and relied on an external end-of-file signal, which proved to be a problem in Linux initramfs requiring a workaround to handle zero-padding.[7] The new format is a lot more flexible and has its own end-of-frame marker. It resembles the Zstd frame format in design.[8]

Implementation

The reference implementation in C by Yann Collet is licensed under a BSD license. There are ports and bindings in various languages including Java, C#, Rust, and Python.[9] The Apache Hadoop system uses this algorithm for fast compression. LZ4 was also implemented natively in the Linux kernel 3.11.[10] The FreeBSD, Illumos, ZFS on Linux, and ZFS-OSX implementations of the ZFS filesystem support the LZ4 algorithm for on-the-fly compression.[11][12][13][14] Linux supports LZ4 for SquashFS since 3.19-rc1.[15] LZ4 is also supported by the newer zstd command line utility by Yann Collet, as well as a 7-Zip fork called 7-Zip-zstd.[16]

References

Page Template:Reflist/styles.css has no content.

  1. ^ Page Module:Citation/CS1/styles.css has no content.Collet, Yann. "LZ4 Frame Format Description". GitHub. Retrieved 7 October 2020.
  2. ^ Page Module:Citation/CS1/styles.css has no content.Michael Larabel (28 January 2013). "Support For Compressing The Linux Kernel With LZ4". Phoronix. Retrieved 28 August 2015.
  3. ^ Page Module:Citation/CS1/styles.css has no content.Collet, Yann (30 March 2019). "LZ4 Block Format Description". GitHub. Retrieved 9 July 2020. There is no entropy encoder back-end nor framing layer.
  4. ^ Script error: No such module "template wrapper".
  5. ^ Page Module:Citation/CS1/styles.css has no content.Yann Collet (26 May 2011). "RealTime Data Compression". Retrieved 28 August 2015.
  6. ^ Page Module:Citation/CS1/styles.css has no content.ticki (25 October 2016). "How LZ4 works". Retrieved 29 June 2017.
  7. ^ Page Module:Citation/CS1/styles.css has no content."lz4/doc/lz4_Frame_format.md at dev · lz4/lz4". GitHub.
  8. ^ Page Module:Citation/CS1/styles.css has no content."LZ4 Frame Format Description".
  9. ^ Extremely Fast Compression algorithm http://www.lz4.org on GitHub
  10. ^ Page Module:Citation/CS1/styles.css has no content.Jonathan Corbet (19 July 2013). "Kernel development". LWN.net. Retrieved 28 August 2015.
  11. ^ Page Module:Citation/CS1/styles.css has no content."FreeBSD 9.2-RELEASE Release Notes". FreeBSD. 13 November 2013. Retrieved 28 August 2015.
  12. ^ Page Module:Citation/CS1/styles.css has no content."LZ4 Compression". illumos. Archived from the original on 9 October 2018. Retrieved 28 August 2015.
  13. ^ Illumos #3035 LZ4 compression support in ZFS and GRUB on GitHub
  14. ^ Page Module:Citation/CS1/styles.css has no content."Features: lz4 compression". OpenZFS. Retrieved 28 August 2015.
  15. ^ Page Module:Citation/CS1/styles.css has no content.Phillip Lougher (27 November 2014). "Squashfs: Add LZ4 compression configuration option". Retrieved 28 August 2015.
  16. ^ 7-zip-zstd
  • No URL found. Please specify a URL here or add one to Wikidata.

Lua error in package.lua at line 80: module 'Module:Navbox/configuration' not found. Lua error in package.lua at line 80: module 'Module:Navbox/configuration' not found. Lua error in package.lua at line 80: module 'Module:Navbox/configuration' not found.