Difference between revisions of "Software: GZIP vs. BZIP2 vs. XZ - performance"
Lukas Dzunko (talk | contribs) (→Compression ratio) |
Lukas Dzunko (talk | contribs) (→Compression ratio) |
||
Line 31: | Line 31: | ||
{|class="wikitable" | {|class="wikitable" | ||
− | ! | + | ! || DVD.iso || fs.bin || linux.tar || random.bin || zero.bin |
|- | |- | ||
− | ! | + | ! source |
|| - || - || - || - || - | || - || - || - || - || - | ||
|- | |- | ||
Line 69: | Line 69: | ||
|- | |- | ||
|} | |} | ||
+ | |||
+ | === Compression === | ||
+ | |||
+ | {|class="wikitable" | ||
+ | ! || DVD.iso || fs.bin || linux.tar || random.bin || zero.bin | ||
+ | |- | ||
+ | ! source | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! gzip -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! gzip -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! gzip -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! bzip2 -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! bzip2 -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! bzip2 -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! xz -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! xz -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! xz -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | |- | ||
+ | |} | ||
+ | |||
+ | === Decompression === | ||
+ | {|class="wikitable" | ||
+ | ! || DVD.iso || fs.bin || linux.tar || random.bin || zero.bin | ||
+ | |- | ||
+ | ! source | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! gzip -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! gzip -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! gzip -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! bzip2 -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! bzip2 -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! bzip2 -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | ! xz -1 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! xz -6 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | ! xz -9 | ||
+ | || - || - || - || - || - | ||
+ | |- | ||
+ | |||
+ | |- | ||
+ | |} | ||
+ | |||
+ | == Sumary == |
Revision as of 15:27, 26 November 2013
I was part of discussion on G+ recently. Discussion was about best possible compression method for Linux kernel. Later it was extended also to user space compression algorithm. I think it will be interesting to see various compress method and levels on different type of files.
Contents
Input data
For test i selected following files:
-
DVD.iso
- iso image containing mpeg2 stream (DVD-Video) and jpeg files (pictures) -
fs.bin
- ext4 file system containing "linux.tar" and "random.bin" -
linux.tar
- tarball archive of Linux kernel sources + objects and final kernel / module images -
random.bin
- file containing data from /dev/urandom -
zero.bin
- file containing only 'zero' data (read /dev/zero)
As a preparation i executed following cycle:
for a in * do for b in 1 6 9 do cat ${a} | gzip -${b} > ${a}.${b}.gz cat ${a} | bzip2 -${b} > ${a}.${b}.bz2 cat ${a} | xz -${b} > ${a}.${b}.xz done done
Test methodology
Test is executed on "Intel(R) Atom(TM) CPU 330 @ 1.60GHz". System was running in dual core mode with HT enabled (SMP). There should be no significant difference using one core and "UP" code as compression/decompression is done in one thread. System was configured with 3GB of usable RAM memory and without CPU frequency scaling. At time of test system was idling. Sequential disk read speed is 80 MB/sec so it should not affect testing. I used /dev/null
as target for compression and decompression to prevent possible problems with concurrent I/O and cache entries.
Result
Compression ratio
Table contain size reported by ls -lh
and stat
:
DVD.iso | fs.bin | linux.tar | random.bin | zero.bin | |
---|---|---|---|---|---|
source | - | - | - | - | - |
gzip -1 | - | - | - | - | - |
gzip -6 | - | - | - | - | - |
gzip -9 | - | - | - | - | - |
bzip2 -1 | - | - | - | - | - |
bzip2 -6 | - | - | - | - | - |
bzip2 -9 | - | - | - | - | - |
xz -1 | - | - | - | - | - |
xz -6 | - | - | - | - | - |
xz -9 | - | - | - | - | - |
Compression
DVD.iso | fs.bin | linux.tar | random.bin | zero.bin | |
---|---|---|---|---|---|
source | - | - | - | - | - |
gzip -1 | - | - | - | - | - |
gzip -6 | - | - | - | - | - |
gzip -9 | - | - | - | - | - |
bzip2 -1 | - | - | - | - | - |
bzip2 -6 | - | - | - | - | - |
bzip2 -9 | - | - | - | - | - |
xz -1 | - | - | - | - | - |
xz -6 | - | - | - | - | - |
xz -9 | - | - | - | - | - |
Decompression
DVD.iso | fs.bin | linux.tar | random.bin | zero.bin | |
---|---|---|---|---|---|
source | - | - | - | - | - |
gzip -1 | - | - | - | - | - |
gzip -6 | - | - | - | - | - |
gzip -9 | - | - | - | - | - |
bzip2 -1 | - | - | - | - | - |
bzip2 -6 | - | - | - | - | - |
bzip2 -9 | - | - | - | - | - |
xz -1 | - | - | - | - | - |
xz -6 | - | - | - | - | - |
xz -9 | - | - | - | - | - |