There has been some fuss generated by Jeff Atwood (who is a Windows developer, which is bad, and a Visual Basic one, which is worse), who seems, in my humble opinion, to be giving partial information around, as closed in his Windows-only world as he appears to be. In a recent article of his, Jeff makes a basic comparison between the ZIP and RAR compression systems. Unfortunately, most Windows people completely ignore that there’s something much better out there, that has been floating in the *nix world for quite a long time now. I’m talking about the powerful combination of tar and bzip2.
Let’s get to the facts right away. To experiment around, I’ve used a directory containing the source code of the Linux kernel, then I built that kernel, so that the size of the directory would be pretty big, and we would have both text files and binary files.
Here’s the size of the original directory:
$ du -sh /usr/src/linux-2.6.18.3 539M linux-2.6.18.3
This is what happens with ZIP:
$ time zip -r ~/linux /usr/src/linux-2.6.18.3 ... real 2m35.917s user 0m32.486s sys 0m6.024s $ ls -gGh ~/linux.zip -rw-r--r-- 1 141M 2007-02-24 01:04 /home/siovene/linux.zip
Fine, 141Mb in 2 minutes and 35 seconds. Let’s try RAR:
$ time ./rar_static a ~/linux.rar /usr/src/linux-2.6.18.3 ... real 5m8.715s user 2m14.012s sys 0m12.473s $ ls -gGh ~/linux.rar -lh -rw-r--r-- 1 132M 2007-02-24 01:26 /home/siovene/linux.rar
Ouch! Double time and just a slightly better compression! Let’s try TAR and BZIP2:
$ time tar cv linux-2.6.18.3 | bzip2 > ~/linux.tar.bz2 ... real 4m22.265s user 2m38.134s sys 0m5.608s $ ls -gGh ~/linux.tar.bz2 -rw-r--r-- 1 90M 2007-02-24 01:09 /home/siovene/linux.tar.bz2
Not too faster than RAR (but using two programs communicating through a pipe, so some overhead), but much more efficient! The compressed file is only 90Mb starting from an original uncompressed of 539Mb
Let’s summarize the data:
Method Time Size zip 2m35s 141Mb rar 5m08s 132Mb tar.bz2 4m22s 90Mb
In conclusion, you should use the best tools, interdependently from their popularity, and remember that there is so much more than what you can see from your Windows-user-perspective.
Tags: benchmark
But, does it have data recovery!?
I only use RAR with a somewhat large recovery record (5% or so). It has allowed me to recover corrupted archives from failing hard disks, cd’s, and of course, crappy data connections.
BTW, what size dictionary were you using with RAR? The newer windows version supports 4096, bringing compression up to where ACE used to be (it has supported 4096 since I can remember). Did you create a solid archive?
Not a fan of your “results” since you only try compressing text files (and don’t give details on compression options). Would be nice to see some binaries, images, combination of all, etc. I found different results for large amounts of jpeg images, binaries, “program folders” (with a combination of all), etc.
Salvatore, you are outdated. LZMA beats the crap out of anything else. A popular LZMA compression implementation is 7zip, also available for windows. But ofcourse, abstracting file metadata and compression is good so having tar.lzma is better
nomel: I was using default options with all the three methods.
suihkukokki: oh well, I’ll have to try that, then
Hi
concerning data recovery there is always par / par2. In my opinion this is much better than built in recovery options.
Look here for more info:
http://parchive.sourceforge.net/
Olaf
Unfair… You should have used the “Best compression” options for the 3 of them. You would have seen that for instance ZIP and RAR have the same compression rate when you use the best scheme.
It’s unfair comparison.
I am compressing a game image at “best” compression rate using Power Archiver 10:
original .iso is 650mb……….
ZIP: took about 3 min and shrunk it to 400mb.
TAR: took 7 min and didn’t make any any difference in size at all….
7ZIP: took about 5 min and shrunk it to 370mb!
Have not tried RAR yet.
> for bob:
Tar is not a compression application. You will havt to use bzip2 on the tar archive at the same time or after to see the actual compressed archive. Please rerun your test and publish your results again.
Twice in my life I stucked due to WinRAR.
Firstly when I sent an email with a .rar file attched the vendor replied “How to open this file” . No need to say
I had to sent a .zip file.
Second time it was my personal problem. I reformatted my PC and went to install all my softwares, but to my
horror all files were in the RAR format. I did this to save some space and to protect files from virus.Worse
was that my PC was not having an internet connection.That day I sweared that I will never use WinRAR
especially for my personal & important files.
Also .zip is the favorite format for corporate users which is not the case with .rar.
Adding another point WinZip generated a revenue of US$ 22.7 Million in 2009 whereas nothing has ever
been reported for WinRAR in this regard.
So its clear that WinZip is better ; WinRAR may be popular but only among pirates.
total 178540
-rwxr-xr-x 1 juk juk 453 2011-01-19 02:43 script.sh
-rw-r–r– 1 juk juk 182818448 2011-01-19 02:17 The Big Bang Theory 101.avi
-rw-r–r– 1 juk juk 0 2011-01-19 02:44 typescript
3bdb5c9c55319c2fc592ad1f79404192c209a4bb The Big Bang Theory 101.avi
7-Zip 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)
Creating archive The Big Bang Theory 101.avi.7z
Compressing [Content]
Everything is Ok
real 5m28.819s
user 5m27.296s
sys 0m10.397s
7-Zip 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)
Creating archive The Big Bang Theory 101.avi.7z-ultra
Compressing [Content]
Everything is Ok
real 5m39.774s
user 5m41.589s
sys 0m11.269s
adding: – (deflated 1%)
real 0m31.463s
user 0m28.822s
sys 0m3.528s
adding: – (deflated 1%)
real 0m22.854s
user 0m20.709s
sys 0m2.336s
real 4m54.301s
user 3m50.514s
sys 0m6.512s
real 1m5.008s
user 0m45.999s
sys 0m3.532s
The Big Bang Theory 101.avi
real 5m47.653s
user 4m7.947s
sys 0m7.752s
The Big Bang Theory 101.avi
real 0m38.216s
user 0m34.266s
sys 0m2.716s
total 1.4G
-rwxr-xr-x 1 juk juk 453 2011-01-19 02:43 script.sh
-rw-r–r– 1 juk juk 175M 2011-01-19 02:17 The Big Bang Theory 101.avi
-rw-r–r– 1 juk juk 174M 2011-01-19 02:50 The Big Bang Theory 101.avi.7z
-rw-r–r– 1 juk juk 174M 2011-01-19 02:56 The Big Bang Theory 101.avi.7z-ultra
-rw-r–r– 1 juk juk 173M 2011-01-19 03:01 The Big Bang Theory 101.avi.bz2
-rw-r–r– 1 juk juk 173M 2011-01-19 03:02 The Big Bang Theory 101.avi.gz
-rw-r–r– 1 juk juk 173M 2011-01-19 03:08 The Big Bang Theory 101.avi.tar.bz
-rw-r–r– 1 juk juk 173M 2011-01-19 03:08 The Big Bang Theory 101.avi.tar.gz
-rw-r–r– 1 juk juk 173M 2011-01-19 02:56 The Big Bang Theory 101.avi.zip
-rw-r–r– 1 juk juk 173M 2011-01-19 02:56 The Big Bang Theory 101.avi.zip.2
-rw-r–r– 1 juk juk 64K 2011-01-19 02:55 typescript
-rw-r–r– 1 juk juk 181153356 2011-01-19 03:02 The Big Bang Theory 101.avi.gz
-rw-r–r– 1 juk juk 181153394 2011-01-19 03:08 The Big Bang Theory 101.avi.tar.gz
-rw-r–r– 1 juk juk 181153485 2011-01-19 07:20 The Big Bang Theory 101.avi.zip.2
-rw-r–r– 1 juk juk 181155066 2011-01-19 02:56 The Big Bang Theory 101.avi.zip
-rw-r–r– 1 juk juk 181385682 2011-01-19 03:08 The Big Bang Theory 101.avi.tar.bz
-rw-r–r– 1 juk juk 181385840 2011-01-19 03:01 The Big Bang Theory 101.avi.bz2
-rw-r–r– 1 juk juk 181996177 2011-01-19 02:56 The Big Bang Theory 101.avi.7z-ultra
-rw-r–r– 1 juk juk 181998441 2011-01-19 02:50 The Big Bang Theory 101.avi.7z
-rw-r–r– 1 juk juk 182818448 2011-01-19 02:17 The Big Bang Theory 101.avi
-rw-r–r– 1 juk juk 65536 2011-01-19 02:55 typescript
-rwxr-xr-x 1 juk juk 453 2011-01-19 02:43 script.sh
total 1419076
3bdb5c9c55319c2fc592ad1f79404192c209a4bb The Big Bang Theory 101.avi
$###################################################################
$cat script.sh
#!/bin/bash
ls -l
FILE=”The Big Bang Theory 101.avi”
sha1sum “$FILE”
time cat “$FILE” | 7z a -si “$FILE.7z”
time cat “$FILE” | 7z a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on “$FILE.7z-ultra”
time cat “$FILE” | zip | cat > “$FILE.zip”
time cat “$FILE” | zip -9 | cat > “$FILE.zip.2″
time cat “$FILE” | bzip2 -9 > “$FILE.bz2″
time cat “$FILE” | gzip -9 > “$FILE.gz”
time tar cv “$FILE” | bzip2 -9 > “$FILE.tar.bz”
time tar cv “$FILE” | gzip -9 > “$FILE.tar.gz”
ls -lh
ls -l | sort
sha1sum “$FILE”
###################################
* GNU zip won *
###################################
( ) /\ _ (
\ | ( \ ( \.( ) _____
\ \ \ ` ` ) \ ( ___ / _ \
(_` \+ . x ( .\ \/ \____———–/ (o) \_
- .- \+ ; ( O \____
(__ +- .( -’.- <. \_____________ ` \ /
(_____ ._._: <_ – <- _- _ VVVVVVV VV V\ \/
. /./.+- . .- / +– – . (–_AAAAAAA__A_/ |
(__ ' /x / x _/ ( \______________//_ \_______
, x / ( ' . / . / \___' \ /
/ / _/ / + | \ /
' (__/ / \/
/ \