壓縮:
解壓:
如果你想親自嘗試了這一點,下載這裡的腳本代碼: 壓縮 | 減壓
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