這裏比較了六種數據壓縮算法,結果代表Brotli算法會代替廣泛使用的Deflate算法。分別用Canterbury compression corpus,web contentcorpus,和 enwik8三種不一樣的數據集來測試,並比較六種算法在壓縮比和壓縮速度上的性能。並且,也代表了Zopfli,LZMA,LZHAM,和 bzip2在壓縮和解壓縮時佔用CPU時間較長,不會直接代替deflate。git
Deflate不只能支持很好的適配如今已有的系統,並且它比較簡單快速的編解碼。所以,不少無損數據壓縮都採用Deflate方法實現的。2013年,谷歌發佈Zopfli,改算法不只兼容Deflate格式,並且支持稠密壓縮。如今Zopfli逐漸普遍被接收,有人開始提出目前應該從Deflate算法向更加先進的算法轉變。Brotli是谷歌開發的一個新一代的壓縮算法。這裏將該算法和其餘已有的壓縮算法進行一個比較。 github
CPUweb |
intel@Xeon CPU E5-1650 v2, 3.5G, 6 core算法 |
操做系統性能 |
Linux 3.13.0測試 |
編譯器google |
GCC 4.8.4spa |
單線程操作系統 |
singel.net |
測試文件1 |
Canterbury compression corpus |
測試文件2 |
A web content, 1285 files and 70611753 bytes |
測試文件3 |
Ebwik8 single file 100M |
LZMA和LAHMA算法,窗口越大,壓縮速度越慢,壓縮比越高。
|
窗口大小(bit) |
版本 |
Brotli |
NA |
Brotli version 0.2.0 |
Deflate |
15 |
Deflate algorithm from zlib 1.2.8 |
Zopfli |
15 |
Zopfli version from github 20150901 |
LZMA |
22 |
LZMA implementation in 7zip 9.20.1 |
LZHAM |
22 |
LZHAM 1.0 stable 1 |
Bzip2 |
NA |
Bzip2 1.0.0 20100906 |
測試結果
Canterbury compression corpus |
|||
算法:級別 |
壓縮比 |
壓縮速度(MB/s) |
解壓縮速度(MB/s) |
Brotli:1 |
3.381 |
98.3 |
334 |
Brotli:9 |
3.965 |
17 |
354.5 |
Brotli:11 |
4.347 |
0.5 |
289.5 |
Deflate:1 |
2.913 |
93.5 |
323 |
Deflate:9 |
3.371 |
15.5 |
347.3 |
Zopfli |
3.58 |
0.2 |
342.1 |
Lzma:1 |
3.847 |
10.2 |
70 |
Lzma:9 |
4.24 |
3.9 |
71.7 |
Lzham:1 |
3.836 |
3.9 |
116 |
Lzham:9 |
3.952 |
0.5 |
117.7 |
Bzip2:1 |
3.757 |
11.8 |
40.4 |
Bzip2:9 |
3.869 |
12 |
40.2 |
A web content, 1285 files and 70611753 bytes |
|||
算法:級別 |
壓縮比 |
壓縮速度(MB/s) |
解壓縮速度(MB/s) |
Brotli:1 |
5.217 |
145.2 |
508.4 |
Brotli:9 |
6.253 |
30.1 |
508.7 |
Brotli:11 |
6.938 |
0.6 |
441.8 |
Deflate:1 |
4.666 |
146.9 |
434.8 |
Deflate:9 |
5.528 |
32.9 |
484.1 |
Zopfli |
5.77 |
0.2 |
460.1 |
Lzma:1 |
5.825 |
7.9 |
100.5 |
Lzma:9 |
6.231 |
4.4 |
102.2 |
Lzham:1 |
5.58 |
4.7 |
168.7 |
Lzham:9 |
5.768 |
0.2 |
172.7 |
Bzip2:1 |
5.71 |
11 |
52.3 |
Bzip2:9 |
5.867 |
11.1 |
52.3 |
Ebwik8 single file 100M |
|||
算法:級別 |
壓縮比 |
壓縮速度(MB/s) |
解壓縮速度(MB/s) |
Brotli:1 |
2.711 |
78.3 |
228.6 |
Brotli:9 |
3.308 |
5.6 |
279.4 |
Brotli:11 |
3.607 |
0.4 |
257.4 |
Deflate:1 |
2.364 |
70.8 |
211.7 |
Deflate:9 |
2.742 |
18.1 |
217.4 |
Zopfli |
2.857 |
0.6 |
227.7 |
Lzma:1 |
3.106 |
9.8 |
60.6 |
Lzma:9 |
3.696 |
3.44 |
71.8 |
Lzham:1 |
3.335 |
2.4 |
177.9 |
Lzham:9 |
3.643 |
0.4 |
192.2 |
Bzip2:1 |
3.007 |
12.3 |
30.8 |
Bzip2:9 |
3.447 |
12.4 |
30.3 |
1. https://zopfli.googlecode.com/files/Data_compression_using_Zopfli.pdf2. https://github.com/google/brotli/releases/tag/v0.2.03. http://www.zlib.net/4. https://github.com/google/zopfli/commit/89cf773beef75d7f4d6d378debdf299378c3314e5. http://www.7zip.org/history.txt6. https://github.com/richgel999/lzham_codec/releases/tag/v1_0_stable17. http://www.bzip.org/8. http://corpus.canterbury.ac.nz/9. http://prize.hutter1.net/10.https://cran.r-project.org/web/packages/brotli/vignettes/brotli-2015-09-22.pdf