"tar -c|gzip" faster than "tar -cz"?!?

Joerg Sonnenberger joerg at britannica.bec.de
Tue Oct 10 13:53:38 PDT 2006


On Tue, Oct 10, 2006 at 07:27:53PM +0200, Oliver Fromme wrote:
> While doing some performance tuning of a backup script
> I noticed that the -z option of our (bsd)tar behaves in
> a very suboptimal way.  It's not only a lot slower than
> using gzip separately, it also compresses worse.
[snip]

I can't replicate this on DragonFly with our version of bsdtar and the
gzip-on-top-libz. At least the later is measurable faster and gives
better compression than GNU gzip.

build# time bsdtar -czf test.tgz contrib/gcc-3.4
2.898u 0.067s 0:03.12 94.5%     204+92k 0+58io 0pf+0w
build# time sh -c "bsdtar -cf - contrib/gcc-3.4 | gzip > test2.tgz"
2.928u 0.099s 0:03.57 84.3%     75+80k 0+58io 0pf+0w

build# ls -l test*.tgz
-rw-r--r--  1 root  wheel  7430189 Oct 10 22:48 test.tgz
-rw-r--r--  1 root  wheel  7430189 Oct 10 22:48 test2.tgz

Joerg


More information about the freebsd-hackers mailing list