Table of Contents

## Appendix A
Statistics for Compression Programs

This appendix gives statistics for some of the compression programs found in this book. The data sets used to test the compression where identical to the ones I used when judging the 1991 Dr. Dobb’s Journal Data Compression Contest. The results of that contest can be found in the November 1991 issue of Dr. Dobb’s Journal.

The compression and expansion speeds given here should be taken with a grain of salt. First of all, no attempt was made to optimize these programs. Secondly, some variation will be seen depending on what compiler was used to build the executable. Most of the executables were built using Borland C++, but in a few cases, expanded memory requirements let me to use Zortech C++ with either the 286 or 386 DOS Extender.

|  | Compression Ratios
--- | --- | ---
| Graphics | Executables | Text Files | Overall
HUFF.C Chapter 3
Huffman Coding | 27.22 | 24.79 | 40.38 | 31.04
AHUFF.C Chapter4
Adaptive Huffman | 32.59 | 26.69 | 40.72 | 33.27
ARITH.C Chapter 5
Arithmetic Coding | 27.78 | 25.25 | 40.81 | 31.51
ARITHN.C Chapter 6
Order = 1 | 61.66 | 44.74 | 59.60 | 54.49
ARITHN.C Chapter 6 (1)
Order = 2 | 59.85 | 50.47 | 68.43 | 59.37
ARITHN.C Chapter 6 (1)
Order = 3 | 58.51 | 51.55 | 71.86 | 60.67
LZSS.C Chapter 8
Index/Length = 12/4 | 43.45 | 41.44 | 58.83 | 48.22
LZSS.C Chapter 8
Index/Length = 13/4 | 44.57 | 42.56 | 60.91 | 49.69
LZSS.C Chapter 8 (3)
Index/Length = 14/4 | 44.71 | 42.32 | 61.10 | 49.70
LZSS.C Chapter 8
Index/Length = 12/3 | 42.83 | 40.38 | 57.27 | 47.10
LZSS.C Chapter 8
Index/Length = 12/5 | 43.91 | 42.31 | 59.21 | 48.81
LZSS.C Chapter 8
Index/Length = 12/8 | 40.60 | 39.60 | 54.67 | 45.29
LZW15V.C Chapter 9
15 bit variable LZW | 48.44 | 36.15 | 58.28 | 47.31
LZW15V.C Chapter 9
14 bit variable LZW | 48.23 | 36.27 | 57.76 | 47.11
LZW15V.C Chapter 9
13 bit variable LZW | 47.76 | 36.34 | 56.71 | 46.65
LZW15V.C Chapter 9
12 bit variable LZW | 46.78 | 36.61 | 54.82 | 45.81
LZW12.C Chapter 9
12 bit fixed LZW | 20.61 | 15.07 | 50.32 | 29.20
HUFF.C Chapter 3
Huffman Coding | 15273 | 13306 | 13353 | 13835
AHUFF.C Chapter 4
Adaptive Huffman | 7553 | 6200 | 7523 | 7028
ARITH.C Chapter 5
Arithmetic Coding | 4616 | 4667 | 4474 | 4584
ARITHN.C Chapter 6
Order = 1 | 804 | 395 | 953 | 702
ARITHN.C Chapter 6 (1)
Order = 2 | 929 | 462 | 1158 | 834
ARITHN.C Chapter 6 (1)
Order = 3 | 975 | 483 | 1206 | 871
LZSS.C Chapter 8
Index/Length = 12/4 | 3657 | 4159 | 3165 | 3671
LZSS.C Chapter 8
Index/Length = 13/4 | 3268 | 3853 | 2839 | 3336
LZSS.C Chapter 8 (3)
Index/Length = 14/4 | 3082 | 3832 | 2563 | 3180
LZSS.C Chapter 8
Index/Length = 12/3 | 4093 | 4392 | 3594 | 4027
LZSS.C Chapter 8
Index/Length = 12/5 | 2942 | 3764 | 2773 | 3194
LZSS.C Chapter 8
Index/Length = 12/8 | 1831 | 1460 | 2411 | 1899
LZW15V.C Chapter 9
15 bit variable LZW | 14913 | 11744 | 13332 | 13140
LZW15V.C Chapter 9
14 bit variable LZW | 14850 | 11332 | 12783 | 12769
LZW15V.C Chapter 9
13 bit variable LZW | 14256 | 10904 | 12241 | 12257
LZW15V.C Chapter 9
12 bit variable LZW | 13669 | 10320 | 11432 | 11591
LZW12.C Chapter 9
12 bit fixed LZW | 13106 | 11057 | 14379 | 12786

|  | Expansion Rates
--- | --- | ---
| Graphics | Executables | Text Files | Overall
HUFF.C Chapter 3
Huffman Coding | 12428 | 10892 | 12560 | 11891
AHUFF.C Chapter 4
Adaptive Huffman | 7366 | 6141 | 7755 | 7041
ARITH.C Chapter 5
Arithmetic Coding | 2320 | 2205 | 2074 | 2188
ARITHN.C Chapter 6
Order = 1 | 793 | 405 | 944 | 700
ARITHN.C Chapter 6 (1)
Order = 2 | 905 | 472 | 1136 | 824
ARITHN.C Chapter 6 (1)
Order = 3 | 946 | 492 | 1173 | 855
LZSS.C Chapter 8
Index/Length = 12/4 | 18622 | 16526 | 17424 | 17394
LZSS.C Chapter 8
Index/Length = 13/4 | 18899 | 16716 | 17798 | 17673
LZSS.C Chapter 8 (3)
Index/Length = 14/4 | 30334 | 25120 | 27120 | 27196
LZSS.C Chapter 8
Index/Length = 12/3 | 18248 | 16572 | 16756 | 17074
LZSS.C Chapter 8
Index/Length = 12/5 | 18680 | 16674 | 17266 | 17409
LZSS.C Chapter 8
Index/Length = 12/8 | 18113 | 16230 | 16673 | 16879
LZW15V.C Chapter 9
15 bit variable LZW | 15167 | 11986 | 13077 | 13206
LZW15V.C Chapter 9
14 bit variable LZW | 14942 | 11804 | 12911 | 13018
LZW15V.C Chapter 9
13 bit variable LZW | 14445 | 11462 | 12495 | 12609
LZW15V.C Chapter 9
12 bit variable LZW | 13567 | 10893 | 11608 | 11845
LZW12.C Chapter 9
12 bit fixed LZW | 15326 | 13978 | 15705 | 14950

> Notes:
> (1) Built with Zortech’s 286 DOS Extender, so as to access all available extended memory. Higher order models can use megabytes of memory.

> (2) Built with Zortech’s 386 DOS Extender. One of the arrays in the program was larger than 64K, and this was an easy way to rebuild the code without using MS-DOS based “huge” pointers.

Table of Contents