"tar -c|gzip" faster than "tar -cz"?!?
olli at lurza.secnetix.de
Fri Oct 13 10:28:47 PDT 2006
Kelly Hall <khall at stbernard.com> wrote:
> > From: Pieter de Goeje <pieter at degoeje.nl>
> > Subject: Re: "tar -c|gzip" faster than "tar -cz"?!?
> > The tar|gzip command uses 18% less CPU and is 10% faster. It
> > is clear the HDD is the bottleneck.
> Now it's clear to me :)
> This makes sense if tar is single-threaded: there's only one thread of
> execution, and it can either be waiting on the disk, or compressing
> data. With two processes, gzip can compress while tar blocks on disk
No. During my tests there was no physical disk I/O (the
disk LED was *OFF* all the time). So tar certainly wasn't
blocking on disk I/O.
The difference in CPU time (and wall clock time) seems
simply to be caused by different compression code. gzip
is noticeably more efficient than libz, at least on the
OS/processor combination where I tested it (Athlon64 with
Depending on the type of data, the difference is between
25% and 40%. If the data is not compressible (like stuff
from /dev/random, or already compressed files), it's only
25%. For very good compressible data (best case: /dev/null),
the difference is 40%.
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
cat man du : where Unix geeks go when they die
More information about the freebsd-hackers