[nSLUG] tar + compression

D G Teed donald.teed at gmail.com
Tue Jan 25 23:50:01 AST 2011


On Tue, Jan 25, 2011 at 11:28 AM, Peter Dobcsanyi <petrus at ftml.net> wrote:

> Using tar with various compression methods.
>
> System: Ubuntu 10.10
> CPU:    Pentium(R) 4 CPU 3.20GHz
> source: Django's mercurial repo with build/ and built docs/ (i.e. mainly
> text)
>
> tar commands with running times:
>
>    tar cf /tmp/d.tar django   0.10s user 0.90s system 29% cpu 3.404 total
>
> tar czf /tmp/d.tar.gz django   16.95s user 1.78s system 101% cpu 18.387
> total
> tar cjf /tmp/d.tar.bz2 django  81.88s user 2.26s system 100% cpu 1:23.57
> total
> tar cJf /tmp/d.tar.xz django   166.25s user 3.80s system 100% cpu 2:48.91
> total
>
> results:
>
> -rw------- 1 peter peter 184176640 2011-01-25 10:23 /tmp/d.tar
> 100.00%
> -rw------- 1 peter peter 128148318 2011-01-25 10:21 /tmp/d.tar.gz
> 69.58%
> -rw------- 1 peter peter 115184718 2011-01-25 10:20 /tmp/d.tar.bz2
>  62.54%
> -rw------- 1 peter peter  93680468 2011-01-25 10:17 /tmp/d.tar.xz
> 50.86%
>
> My conclusion:  gzip is a good compromise between time and compression
> ratio.
>                YMMV
>


When I was working on disk imaging with udpcast, I found lzop was a very
good
performer on lesser powered CPUs such as 1999 vintage Sun hardware.

Here is a test of compression on an Atom based Linux box.

Original tar files - identical:

-rw-r--r-- 1 root root 2314240 2011-01-25 23:40 test1.tar
-rw-r--r-- 1 root root 2314240 2011-01-25 23:40 test2.tar


Gzip:
> time gzip test2.tar

real    0m0.337s
user    0m0.300s
sys    0m0.004s

> ls -l test2.tar.gz
-rw-r--r-- 1 root root 1035813 2011-01-25 23:40 test2.tar.gz

Lzop:

> time lzop test1.tar

real    0m0.101s
user    0m0.084s
sys    0m0.016s

> ls -l test1.tar.lzo
-rw-r--r-- 1 root root 1119380 2011-01-25 23:40 test1.tar.lzo

If time or CPU load is more important than the
disk footprint, lzop can be handy.

--Donald
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nslug.ns.ca/mailman/private/nslug/attachments/20110125/77da9eb0/attachment-0002.html>


More information about the nSLUG mailing list