Subject: Re: Bzip versus Gzip
To: None <netbsd-users@netbsd.org>
From: Martijn van Buul <martijnb@atlas.ipv6.stack.nl>
List: netbsd-users
Date: 07/05/2005 20:16:40
It occurred to me that Zafer Aydogan wrote in gmane.os.netbsd.general:
> Hello List,
>
> is there an approach to replace the .tgz binary packages with .tbz
> in the near Future ?
I surely hope not.
> bzip2 is more effective and would save space and bandwidth on the NetBSD
> Servers/Mirrors.
bzip2 more effective? That's depending on how you consider "efficiency".
A small, but probably significant test:
I tarred up my /usr/pkg/bin; times on a celeron 1300.
atlas# du -h bin.tar
163M bin.tar
atlas# time gzip bin.tar
33.5u 2.7s 0:36.85 98.3% 0+0k 6+25io 5pf+0w
atlas# du -h bin.tar.gz
64M bin.tar.gz
So far so good. Gzip compressed it to 39%, and needed 34 seconds for that,
excluding system overhead.
atlas# time gunzip bin.tar.gz
4.9u 2.2s 0:08.44 85.1% 0+0k 10+28io 0pf+0w
Gunzip took a meager 6.2 seconds, excluding system overhead, to decompress
the resulting archive.
Now on to bzip2:
atlas# time bzip2 bin.tar
136.8u 1.2s 2:19.71 98.8% 0+0k 0+39io 6pf+0w
Even though bzip2 had the advantage of having the originating tar in cache
(system overhead is only 1.2 seconds), it took a whopping 2:18.5, or 138.5
seconds to compress the tar. That's 4 times as slow as gzip. And is the
result mindboggingly more compressed?
atlas# du -h bin.tar.bz2
56M bin.tar.bz2
No. It compresses to 34.5%. A net gain of 4.5%, or 12%, depending on how
you look at it. Now, if it was only the *compression* which takes an awful
lot of time, it wouldn't have been so bad, but no:
atlas# time bunzip2 bin.tar.bz2
44.9u 2.8s 0:48.33 98.7% 0+0k 0+34io 1pf+0w
45.5 seconds! *7* times as slow as gunzip!
Now this may not be an issue to all those spiffy fast 10 GHz 64 bit machines
around, but those of us who still have older hardware around really don't
want this overhead. The net worth really doesn't warrant for it.