Compaction Algorithm (pack vs compress)
Ray Lubinsky
rwl at uvacs.UUCP
Wed Feb 26 06:09:32 AEST 1986
> > I am in need of a packing algorithm which works better than the
> > PACK Utility of UNIX. I have also looked at COMPRESS ( developed
> > at University of Utah ). COMPRESS works great if distinct number
> > of input bytes is small. But if the distinct input bytes reach
> > 256 ( binary data ), PACK works better than COMPRESS. With PACK
> > I am getting a saving of 20-25%. If anybody has an algorithm
> > that would do better in packing "load modules", I would like to
> > know about it.
>
> Are you sure you have the latest version of "compress"? I tried "pack"ing
> and "compress"ing "/usr/bin/suntools" (which is a BMF executable image) and
> "compress" did significantly better than "pack" did (it took significantly
> more time doing it, but that's life). Remember, Lempel-Ziv compression will
> discover frequently-occurring sequences of bytes, and unless your machine
> has all one-byte instructions you're likely to get some multi-byte sequences
> occurring frequently.
> --
> Guy Harris
> {ihnp4, decvax, seismo, decwrl, ...}!sun!guy
> guy at sun.arpa (yes, really)
Hold on thar, Babaloo! If you mean better in terms of *byte* savings, I
imagine ``compress'' could easily do better than ``pack''. But if you're
talking about *block* savings, I'm dubious that ``pack'' will be much improved
upon. I don't know about your system, but my Vax running 4.2 BSD permits
internal fragmentation, so it's disk block savings that count.
Now, I'm not entirely familiar with ``compress'', but I can compare with
``compact''. When I created a file of 2000 bytes (one identical character
per line plus a newline), ``compress'' boasted of > 85% compression, while
pack only claimed 50% compression, but each of the results consumed the same
amount of blocks. Hence the same effective compression.
Sqeezing a few extra bytes out of a file can only be worth it if it results in
reducing by the 1K minimum data block size (2 basic file system blocks). Is
this often the case? (On my system, ``pack'' runs considerably faster than
``compact'', so the choice is easy.)
--
Ray Lubinsky University of Virginia, Dept. of Computer Science
UUCP: ...!cbosgd!uvacs!rwl or ...!decvax!mcnc!ncsu!uvacs!rwl
More information about the Comp.lang.c
mailing list