| 1 | LZ4 - Extremely fast compression |
| 2 | ================================ |
| 3 | |
| 4 | LZ4 is lossless compression algorithm, |
| 5 | providing compression speed at 400 MB/s per core, |
| 6 | scalable with multi-cores CPU. |
| 7 | It features an extremely fast decoder, |
| 8 | with speed in multiple GB/s per core, |
| 9 | typically reaching RAM speed limits on multi-core systems. |
| 10 | |
| 11 | Speed can be tuned dynamically, selecting an "acceleration" factor |
| 12 | which trades compression ratio for more speed up. |
| 13 | On the other end, a high compression derivative, LZ4_HC, is also provided, |
| 14 | trading CPU time for improved compression ratio. |
| 15 | All versions feature the same decompression speed. |
| 16 | |
| 17 | LZ4 library is provided as open-source software using BSD license.s |
| 18 | |
| 19 | |
| 20 | |Branch |Status | |
| 21 | |------------|---------| |
| 22 | |master | [![Build Status][travisMasterBadge]][travisLink] [![Build status][AppveyorMasterBadge]][AppveyorLink] [![coverity][coverBadge]][coverlink] | |
| 23 | |dev | [![Build Status][travisDevBadge]][travisLink] [![Build status][AppveyorDevBadge]][AppveyorLink] | |
| 24 | |
| 25 | [travisMasterBadge]: https://travis-ci.org/Cyan4973/lz4.svg?branch=master "Continuous Integration test suite" |
| 26 | [travisDevBadge]: https://travis-ci.org/Cyan4973/lz4.svg?branch=dev "Continuous Integration test suite" |
| 27 | [travisLink]: https://ci.appveyor.com/project/YannCollet/lz4 |
| 28 | [AppveyorMasterBadge]: https://ci.appveyor.com/api/projects/status/v6kxv9si529477cq/branch/master?svg=true "Visual test suite" |
| 29 | [AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/v6kxv9si529477cq/branch/dev?svg=true "Visual test suite" |
| 30 | [AppveyorLink]: https://ci.appveyor.com/project/YannCollet/lz4 |
| 31 | [coverBadge]: https://scan.coverity.com/projects/4735/badge.svg "Static code analysis of Master branch" |
| 32 | [coverlink]: https://scan.coverity.com/projects/4735 |
| 33 | |
| 34 | > **Branch Policy:** |
| 35 | |
| 36 | > - The "master" branch is considered stable, at all times. |
| 37 | > - The "dev" branch is the one where all contributions must be merged |
| 38 | before being promoted to master. |
| 39 | > + If you plan to propose a patch, please commit into the "dev" branch, |
| 40 | or its own feature branch. |
| 41 | Direct commit to "master" are not permitted. |
| 42 | |
| 43 | Benchmarks |
| 44 | ------------------------- |
| 45 | |
| 46 | The benchmark uses the [Open-Source Benchmark program by m^2 (v0.14.3)] |
| 47 | compiled with GCC v4.8.2 on Linux Mint 64-bits v17. |
| 48 | The reference system uses a Core i5-4300U @1.9GHz. |
| 49 | Benchmark evaluates the compression of reference [Silesia Corpus] |
| 50 | in single-thread mode. |
| 51 | |
| 52 | | Compressor | Ratio | Compression | Decompression | |
| 53 | | ---------- | ----- | ----------- | ------------- | |
| 54 | | memcpy | 1.000 | 4200 MB/s | 4200 MB/s | |
| 55 | |**LZ4 fast 17 (r129)**| 1.607 |**690 MB/s** | **2220 MB/s** | |
| 56 | |**LZ4 default (r129)**|**2.101**|**385 MB/s** | **1850 MB/s** | |
| 57 | | LZO 2.06 | 2.108 | 350 MB/s | 510 MB/s | |
| 58 | | QuickLZ 1.5.1.b6 | 2.238 | 320 MB/s | 380 MB/s | |
| 59 | | Snappy 1.1.0 | 2.091 | 250 MB/s | 960 MB/s | |
| 60 | | LZF v3.6 | 2.073 | 175 MB/s | 500 MB/s | |
| 61 | | zlib 1.2.8 -1 | 2.730 | 59 MB/s | 250 MB/s | |
| 62 | |**LZ4 HC (r129)** |**2.720**| 22 MB/s | **1830 MB/s** | |
| 63 | | zlib 1.2.8 -6 | 3.099 | 18 MB/s | 270 MB/s | |
| 64 | |
| 65 | |
| 66 | Documentation |
| 67 | ------------------------- |
| 68 | |
| 69 | The raw LZ4 block compression format is detailed within [lz4_Block_format]. |
| 70 | |
| 71 | To compress an arbitrarily long file or data stream, multiple blocks are required. |
| 72 | Organizing these blocks and providing a common header format to handle their content |
| 73 | is the purpose of the Frame format, defined into [lz4_Frame_format]. |
| 74 | Interoperable versions of LZ4 must respect this frame format. |
| 75 | |
| 76 | |
| 77 | Other source versions |
| 78 | ------------------------- |
| 79 | |
| 80 | Beyond the C reference source, |
| 81 | many contributors have created versions of lz4 in multiple languages |
| 82 | (Java, C#, Python, Perl, Ruby, etc.). |
| 83 | A list of known source ports is maintained on the [LZ4 Homepage]. |
| 84 | |
| 85 | |
| 86 | [Open-Source Benchmark program by m^2 (v0.14.3)]: http://encode.ru/threads/1371-Filesystem-benchmark?p=34029&viewfull=1#post34029 |
| 87 | [Silesia Corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia |
| 88 | [lz4_Block_format]: lz4_Block_format.md |
| 89 | [lz4_Frame_format]: lz4_Frame_format.md |
| 90 | [LZ4 Homepage]: http://www.lz4.org |