为了保证能够让压缩比率较为明显,需选取一个内容较多、占用空间较大的目录作为本次实验的测试。
找了一个大概有23G的目录来测试
首先明确一个概念:
压缩比率=原内容大小/压缩后大小,压缩比率越大,则表明压缩后占用空间的压缩包越小
tar
打包:
time tar -cvf test.tar /usr/test
时间:
real 3m20.709s
user 0m3.477s
sys 0m42.595s
大小:
打包前:23214680
打包后:22202984
耗时:3m20.709s
压缩比率:22202984/23214680
解压:
time tar -xvf test.tar
大小:
解压前:22202984
解压后:23211064
耗时:
real 2m47.548s
user 0m4.999s
sys 1m14.186s
tgz
打包压缩:
time tar -zcvf test.tgz /usr/test
时间:
real 16m30.767s
user 16m1.394s
sys 1m7.391s
大小:
打包前:23211064
打包后:18949032
耗时:
压缩比率:
解压:
tar -zxvf test.tar
大小:
解压前:18949032
解压后:23211064
耗时:
real 3m52.418s
user 2m46.325s
sys 1m21.442s
tar.bz2