Linux下解压工具对比(图表)

Elementary OS团队的成员Shnatsel发布了关于自由Linux压缩工具的测试对比。下面是压缩和解压缩的数据(其中发现的一些问题,该同学已经写了脚本,可下载安装)。

压缩:
Linux下解压工具对比(图表)

解压:
Linux下解压工具对比(图表)

如果你想亲自尝试了这一点,下载这里的脚本代码: 压缩 | 减压

for testnum in $(seq 1 256); do
    testnum=$(expr $testnum '*' 10)
    for archiver in bzip2 lzma xz gzip lzip lzop lrzip; do
        dd if=/dev/zero of=$testnum.zero bs="$testnum"'k' count=1
        c=$(date +%s%N)
        $archiver $testnum.zero
        d=$(date +%s%N)
        total=$(echo $d-$c | bc)
        echo $total >> $archiver
        rm $testnum.zero *.bz2 *.lzma *.gz *.xz *.lzo *.lz *.lrz
    done
done
gnuplot <(echo "set terminal svg;set ylabel 'Time (nanoseconds)' textcolor lt 1; set xlabel 'Size (tens of kilobytes)' textcolor lt 2;plot 'lzma' with lines, 'xz' with lines, 'gzip' with lines, 'lzip' with lines, 'lzop' with lines, 'lrzip' with lines, 'bzip2' with lines") > test.svg
rm gzip lrzip lzip lzma lzop xz bzip2

===========================================================

for testnum in $(seq 0 256); do
    testnum=$(expr $testnum '*' 10)
    for archiver in bzip2 lzma xz gzip lzip lzop lrzip; do
        dd if=/dev/zero of=$testnum.zero bs="$testnum"'k' count=1
        $archiver $testnum.zero
        rm $testnum.zero
        c=$(date +%s%N)
        $archiver -d $testnum.zero.*
        d=$(date +%s%N)
        total=$(echo $d-$c | bc)
        echo $total >> $archiver
        rm $testnum.zero *.bz2 *.lzma *.gz *.xz *.lzo *.lz *.lrz
    done
done
gnuplot <(echo "set terminal svg;set ylabel 'Time (nanoseconds)' textcolor lt 1; set xlabel 'Size (tens of kilobytes)' textcolor lt 2;plot 'lzma' with lines, 'xz' with lines, 'gzip' with lines, 'lzip' with lines, 'lzop' with lines, 'lrzip' with lines, 'bzip2' with lines") > test.svg
rm gzip lrzip lzip lzma lzop xz bzip2

此外,如果您要使用上面的脚本,确保安装了所有所需的软件包:

sudo apt-get install gnuplot bzip2 lzma xz-utils gzip lzip lzop lrzip  

相关推荐