README.md
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 2-Clause license.
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/lz4/lz4.svg?branch=master "Continuous Integration test suite"
26 [travisDevBadge]: https://travis-ci.org/lz4/lz4.svg?branch=dev "Continuous Integration test suite"
27 [travisLink]: https://travis-ci.org/lz4/lz4
28 [AppveyorMasterBadge]: https://ci.appveyor.com/api/projects/status/jc2yhgwyc7qqtsko/branch/master?svg=true "Windows test suite"
29 [AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/jc2yhgwyc7qqtsko/branch/dev?svg=true "Windows test suite"
30 [AppveyorLink]: https://ci.appveyor.com/project/YannCollet/lz4-1lndh
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 [lzbench], from @inikep
47 compiled with GCC v6.2.0 on Linux 64-bits.
48 The reference system uses a Core i7-3930K CPU @ 4.5GHz.
49 Benchmark evaluates the compression of reference [Silesia Corpus]
50 in single-thread mode.
51
52 [lzbench]: https://github.com/inikep/lzbench
53 [Silesia Corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
54
55 | Compressor | Ratio | Compression | Decompression |
56 | ---------- | ----- | ----------- | ------------- |
57 | memcpy | 1.000 | 7300 MB/s | 7300 MB/s |
58 |**LZ4 fast 8 (v1.7.3)**| 1.799 |**911 MB/s** | **3360 MB/s** |
59 |**LZ4 default (v1.7.3)**|**2.101**|**625 MB/s** | **3220 MB/s** |
60 | LZO 2.09 | 2.108 | 620 MB/s | 845 MB/s |
61 | QuickLZ 1.5.0 | 2.238 | 510 MB/s | 600 MB/s |
62 | Snappy 1.1.3 | 2.091 | 450 MB/s | 1550 MB/s |
63 | LZF v3.6 | 2.073 | 365 MB/s | 820 MB/s |
64 | [Zstandard] 1.1.1 -1 | 2.876 | 330 MB/s | 930 MB/s |
65 | [Zstandard] 1.1.1 -3 | 3.164 | 200 MB/s | 810 MB/s |
66 | [zlib] deflate 1.2.8 -1| 2.730 | 100 MB/s | 370 MB/s |
67 |**LZ4 HC -9 (v1.7.3)** |**2.720**| 34 MB/s | **3240 MB/s** |
68 | [zlib] deflate 1.2.8 -6| 3.099 | 33 MB/s | 390 MB/s |
69
70 [zlib]: http://www.zlib.net/
71 [Zstandard]: http://www.zstd.net/
72
73 LZ4 is also compatible and well optimized for x32 mode, for which it provides +10% speed performance.
74
75
76 Documentation
77 -------------------------
78
79 The raw LZ4 block compression format is detailed within [lz4_Block_format].
80
81 To compress an arbitrarily long file or data stream, multiple blocks are required.
82 Organizing these blocks and providing a common header format to handle their content
83 is the purpose of the Frame format, defined into [lz4_Frame_format].
84 Interoperable versions of LZ4 must respect this frame format.
85
86 [lz4_Block_format]: doc/lz4_Block_format.md
87 [lz4_Frame_format]: doc/lz4_Frame_format.md
88
89
90 Other source versions
91 -------------------------
92
93 Beyond the C reference source,
94 many contributors have created versions of lz4 in multiple languages
95 (Java, C#, Python, Perl, Ruby, etc.).
96 A list of known source ports is maintained on the [LZ4 Homepage].
97
98 [LZ4 Homepage]: http://www.lz4.org
99