圧縮コマンドの簡単な比較
テストデータはツイッターAPIでツイートを取得した 27,967件のJSONデータ。
# wc -l test.txt
27967 test.txt
lzo, gzip, bzip2 を比較。
ざっくり以下の様な感じか。
もちろん結果はデータ特性(冗長性の大小とか)によると思いますよっと。
lzo | gzip | bzip2 | |
ファイルサイズ | 1/4 | 1/8 | 1/10 |
圧縮処理時間 | 1 | 7 | 50 |
解凍処理時間 | 1 | 3 | 12 |
ファイルサイズはテキストを1とした比率。
圧縮・解凍処理時間はlzoを1とした比率。
データサイズ
# ll -h test.txt* -rw-rw-r-- 1 root root 100M 7月 15 20:19 2014 test.txt -rw-rw-r-- 1 root root 9.6M 7月 15 20:19 2014 test.txt.bz2 -rw-rw-r-- 1 root root 14M 7月 15 20:19 2014 test.txt.gz -rw-rw-r-- 1 root root 23M 7月 15 20:19 2014 test.txt.lzo
圧縮処理時間
# time lzop -U test.txt real 0m0.477s user 0m0.418s sys 0m0.057s # time gzip test.txt real 0m3.127s user 0m3.065s sys 0m0.054s # time bzip2 test.txt real 0m23.838s user 0m23.268s sys 0m0.055s
解凍処理時間
# time lzop -d test.txt.lzo real 0m0.286s user 0m0.211s sys 0m0.073s # time gzip -d test.txt.gz real 0m0.704s user 0m0.637s sys 0m0.064s # time bzip2 -d test.txt.bz2 real 0m3.546s user 0m3.418s sys 0m0.119s