Go to the first, previous, next, last section, table of contents.


Choosing a compression method

The table below gives some idea of the efficiency of the various algorithm/cluster size pairs. (The data were collected on a 66MHz 486 with the BIOS set with all the slow options, by the way.)

The information could certainly be improved. (E.g. what effect does file size have? What about writing? (I (pjm) had hoped `chattr +c' would give this information, but I note that the times for `tar' and `chattr -c' do not correlate as well as I'd expected. I wonder if tar is reading 4KB at a time while `chattr -c' a cluster at a time? Is st_blksize set to cluster size for compressed files? [pjm: No, it's not. However, I wouldn't have thought it would make much difference, since decompression always happens a cluster at a time, while compression only happens when the file is closed.])) If you have the curiosity to do some timing of your own, send me the results (together with the script for generating them). Two hints on timing: (i) Don't use the machine for anything else while timing. It does make a difference, and not just to elapsed wall-clock time. (Kill off daemons if you're really keen.) (ii) Make sure you haven't got any energy-saving things active in your BIOS setup.

for a in gzip9 gzip6 gzip3 lzrw3a lzv1; do 
  for b in 32 16 8 4; do 
    for t in 1 2; do 
      clear-disk-cache
      time chattr +c -R -m $a -b $b /usr/doc; clear-disk-cache
      time du -s /usr/doc
      time tar cf - /usr/doc | md5sum; clear-disk-cache
      time chattr -c -R /usr/doc
      echo done $b $a
    done
    echo
  done
done

The table below has been formatted, and sorted by compression ratio. (The md5 sums were identical, you'll be happy to know.)

 ch+               du               tar (read)        ch-              cs alg  
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~ ~~~~~
0.16u 203.9s 3:51 2257 0.16u 0.84s 0.59u 93.88s 1:49 0.17u 20.09s 0:36 32 gzip9
0.20u 204.0s 3:50 2257 0.21u 0.81s 0.62u 93.75s 1:49 0.20u 19.43s 0:36 32 gzip9

0.17u 127.3s 2:33 2260 0.15u 0.80s 0.56u 93.86s 1:48 0.29u 20.36s 0:38 32 gzip6
0.11u 127.4s 2:35 2260 0.14u 0.81s 0.65u 93.68s 1:48 0.10u 20.23s 0:36 32 gzip6

0.17u  66.7s 1:31 2400 0.13u 0.76s 0.46u 95.83s 1:50 0.19u 20.31s 0:36 32 gzip3
0.23u  66.5s 1:32 2400 0.17u 0.69s 0.66u 95.67s 1:50 0.26u 20.06s 0:38 32 gzip3

0.16u 145.3s 2:52 2406 0.18u 0.64s 0.61u 58.82s 1:13 0.25u 20.24s 0:38 16 gzip9
0.22u 145.2s 2:53 2406 0.14u 0.80s 0.47u 58.00s 1:13 0.24u 20.26s 0:38 16 gzip9

0.17u 107.5s 2:14 2409 0.17u 0.72s 0.69u 57.87s 1:13 0.24u 20.10s 0:38 16 gzip6
0.28u 107.0s 2:12 2409 0.12u 0.82s 0.53u 58.11s 1:13 0.33u 20.07s 0:38 16 gzip6

0.15u  64.2s 1:29 2525 0.18u 0.78s 0.65u 58.80s 1:14 0.16u 20.40s 0:39 16 gzip3
0.16u  63.8s 1:29 2525 0.17u 0.85s 0.70u 58.85s 1:15 0.23u 20.49s 0:41 16 gzip3

0.22u 109.3s 2:22 2681 0.15u 0.80s 0.73u 37.23s 0:54 0.15u 21.65s 0:46 08 gzip9

0.30u  92.9s 2:06 2682 0.13u 0.78s 0.65u 38.03s 0:56 0.17u 21.38s 0:50 08 gzip6

0.21u  63.4s 1:35 2757 0.15u 0.79s 0.71u 37.62s 0:55 0.18u 21.51s 0:46 08 gzip3

0.15u  29.0s 0:53 2898 0.20u 0.80s 0.56u 41.78s 0:58 0.13u 13.61s 0:32 32 lzrw3a
0.15u  29.0s 0:52 2898 0.17u 0.96s 0.69u 41.64s 0:58 0.19u 13.99s 0:32 32 lzrw3a

0.22u  93.6s 2:11 2919 0.21u 0.64s 0.76u 25.62s 0:45 0.22u 24.51s 1:04 04 gzip9

0.17u  87.7s 2:07 2919 0.17u 0.78s 0.72u 25.54s 0:46 0.25u 24.16s 1:03 04 gzip6

0.17u  68.0s 1:45 2983 0.21u 0.68s 0.67u 25.99s 0:46 0.22u 25.17s 1:04 04 gzip3

0.16u  29.0s 0:53 3080 0.14u 0.70s 0.56u 28.95s 0:47 0.20u 13.88s 0:34 16 lzrw3a
0.22u  28.9s 0:53 3080 0.19u 0.74s 0.67u 28.96s 0:47 0.18u 13.75s 0:33 16 lzrw3a

0.12u  17.6s 0:39 3179 0.17u 0.76s 0.56u 23.81s 0:41 0.18u  8.87s 0:28 32 lzv1
0.21u  17.5s 0:41 3179 0.14u 0.83s 0.67u 23.82s 0:42 0.19u  8.59s 0:30 32 lzv1

0.16u  17.9s 0:38 3310 0.11u 0.85s 0.63u 16.75s 0:35 0.15u  9.00s 0:30 16 lzv1
0.18u  17.7s 0:41 3310 0.15u 0.95s 0.75u 16.75s 0:37 0.21u  8.98s 0:29 16 lzv1

0.17u  29.9s 1:03 3385 0.20u 0.80s 0.58u 21.87s 0:42 0.18u 14.49s 0:40 08 lzrw3a

0.19u  18.0s 0:58 3559 0.17u 0.74s 0.66u 12.92s 0:37 0.11u  9.14s 0:40 08 lzv1

0.19u  32.3s 1:10 3965 0.16u 0.71s 0.64u 17.71s 0:40 0.21u 16.35s 0:58 04 lzrw3a

0.17u  19.3s 1:00 4025 0.11u 0.74s 0.66u 10.36s 0:34 0.26u  9.33s 0:45 04 lzv1


Go to the first, previous, next, last section, table of contents.