"tar -c|gzip" faster than "tar -cz"?!?
Matthew Dillon
dillon at apollo.backplane.com
Fri Oct 13 10:19:51 PDT 2006
:
:Just a silly one but are you guys using the same
:version of gzip, would be worth just checking?
It could also simply be a piplining issue. If the pipe inbetween the
'tar' and the 'gzip' is too small (whether gzip is internal to tar
or not), then the 'tar' portion could wind up getting blocked by the
'gzip' portion and not do disk I/O in parallel with the cpu that the gzip
portion uses.
Here I am presuming that there is in fact a fork internal to tar when
using the built-in gzip. There had better be, or performance would be
horrible!
In anycase, the pipe buffer needs to be at least 2x the block size gzip
uses internally when compressing. I would even recommend making it
very large, like several hundred kilobytes (at least). It is the
same problem one faces when, say, streaming data to a slow device such
as a tape drive. You want a large pipe buffer to avoid unsightly stalls
of the code scanning the filesystem.
-Matt
More information about the freebsd-hackers
mailing list