Useless fuss about ZIP and RAR

Feb 24 2007

There has been some fuss gen­er­ated by Jeff Atwood (who is a Win­dows devel­oper, which is bad, and a Visual Basic one, which is worse), who seems, in my hum­ble opin­ion, to be giv­ing par­tial infor­ma­tion around, as closed in his Windows-only world as he appears to be. In a recent arti­cle of his, Jeff makes a basic com­par­i­son between the ZIP and RAR com­pres­sion sys­tems. Unfor­tu­nately, most Win­dows peo­ple com­pletely ignore that there’s some­thing much bet­ter out there, that has been float­ing in the *nix world for quite a long time now. I’m talk­ing about the pow­er­ful com­bi­na­tion of tar and bzip2.

Let’s get to the facts right away. To exper­i­ment around, I’ve used a direc­tory con­tain­ing the source code of the Linux ker­nel, then I built that ker­nel, so that the size of the direc­tory would be pretty big, and we would have both text files and binary files.

Here’s the size of the orig­i­nal directory:

$ du -sh /usr/src/linux-2.6.18.3
539M    linux-2.6.18.3

This is what hap­pens 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 min­utes and 35 sec­onds. 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! Dou­ble time and just a slightly bet­ter com­pres­sion! 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 pro­grams com­mu­ni­cat­ing through a pipe, so some over­head), but much more effi­cient! The com­pressed file is only 90Mb start­ing from an orig­i­nal uncom­pressed of 539Mb

Let’s sum­ma­rize the data:

Method        Time        Size
zip           2m35s       141Mb
rar           5m08s       132Mb
tar.bz2       4m22s       90Mb

In con­clu­sion, you should use the best tools, inter­de­pen­dently from their pop­u­lar­ity, and remem­ber that there is so much more than what you can see from your Windows-user-perspective.

Tags:

10 responses so far

  1. But, does it have data recovery!?

    I only use RAR with a some­what large recov­ery record (5% or so). It has allowed me to recover cor­rupted archives from fail­ing hard disks, cd’s, and of course, crappy data connections.

    BTW, what size dic­tio­nary were you using with RAR? The newer win­dows ver­sion sup­ports 4096, bring­ing com­pres­sion up to where ACE used to be (it has sup­ported 4096 since I can remem­ber). Did you cre­ate a solid archive?

    Not a fan of your “results” since you only try com­press­ing text files (and don’t give details on com­pres­sion options). Would be nice to see some bina­ries, images, com­bi­na­tion of all, etc. I found dif­fer­ent results for large amounts of jpeg images, bina­ries, “pro­gram fold­ers” (with a com­bi­na­tion of all), etc.

  2. Sal­va­tore, you are out­dated. LZMA beats the crap out of any­thing else. A pop­u­lar LZMA com­pres­sion imple­men­ta­tion is 7zip, also avail­able for win­dows. But ofcourse, abstract­ing file meta­data and com­pres­sion is good so hav­ing tar.lzma is bet­ter :)

  3. nomel: I was using default options with all the three methods.

  4. suihkukokki: oh well, I’ll have to try that, then :)

  5. Hi

    con­cern­ing data recov­ery there is always par / par2. In my opin­ion this is much bet­ter than built in recov­ery options.

    Look here for more info:
    http://parchive.sourceforge.net/

    Olaf

  6. Unfair… You should have used the “Best com­pres­sion” options for the 3 of them. You would have seen that for instance ZIP and RAR have the same com­pres­sion rate when you use the best scheme.

  7. It’s unfair comparison.

  8. I am com­press­ing a game image at “best” com­pres­sion rate using Power Archiver 10:

    orig­i­nal .iso is 650mb.….…..

    ZIP: took about 3 min and shrunk it to 400mb.

    TAR: took 7 min and didn’t make any any dif­fer­ence in size at all.…

    7ZIP: took about 5 min and shrunk it to 370mb!

    Have not tried RAR yet.

  9. > for bob:

    Tar is not a com­pres­sion appli­ca­tion. You will havt to use bzip2 on the tar archive at the same time or after to see the actual com­pressed archive. Please rerun your test and pub­lish your results again.

  10. Twice in my life I stucked due to Win­RAR.
    Firstly when I sent an email with a .rar file attched the ven­dor replied “How to open this file” . No need to say

    I had to sent a .zip file.

    Sec­ond time it was my per­sonal prob­lem. I refor­mat­ted my PC and went to install all my soft­wares, but to my

    hor­ror all files were in the RAR for­mat. I did this to save some space and to pro­tect files from virus.Worse

    was that my PC was not hav­ing an inter­net connection.That day I sweared that I will never use WinRAR

    espe­cially for my per­sonal & impor­tant files.

    Also .zip is the favorite for­mat for cor­po­rate users which is not the case with .rar.
    Adding another point WinZip gen­er­ated a rev­enue of US$ 22.7 Mil­lion in 2009 whereas noth­ing has ever

    been reported for Win­RAR in this regard.
    So its clear that WinZip is bet­ter ; Win­RAR may be pop­u­lar but only among pirates.

Leave a Reply