Compressors, Shrinkers, Imploders…
Or: What Do You Need a Packer for at Home?
A common problem for computer users who collect programs is the need to buy more storage media (disks or tapes). Games are generally quite large and take up a lot of space on a medium. Waiting for a program to load can also get annoying sometimes.
That is where someone came up with the wonderful idea of writing a program that would “shorten” memory blocks by removing “unnecessary” bytes. That is how I put it; in reality, it works a little differently.
What does compression mean? (I’ll use this word for all kinds of “packing”.) It is a process that searches memory for consecutive repeated bytes and replaces them with a single agreed-upon marker. Another method is to search for the most frequently repeated sequences of bytes and replace them with one such sequence in memory, while special markers indicate where to put that sequence. Several methods are often combined, which can make compression more effective.
This is not, however, an article about how to write your own compressor. Here I compare the best Spectrum compressors.
To find out which one is best, I used some thoroughly ordinary memory blocks. In this case, “best” is not quite the right word: each of these programs has its own advantages and disadvantages.
I should also mention that writing this article cost me two days just for the compression tests. Still, I think I tested almost everything—or at least the most common cases.
But let’s get to the comparison.
Music samples
First, I thought I’d try some samples. For this, I took one of Kriss’s tunes.
Sample-Music — length: 21,383 bytes
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 11,439 | 1 |
| PACK MAKER | 9,620 | 4 |
| TOMPACKER | 10,037 | 2 |
| TURBO IMPLODER | 10,031 | 3 |
Game data
Next, I took a 32,768-byte block from the game SAVAGE 1, starting at address 32768. I chose this block because it contains music, graphics and code—in other words, everything that makes up the whole program.
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 20,955 | 2 |
| PACK MAKER | 23,180 | 1 |
| TOMPACKER | 20,224 | 3 |
| TURBO IMPLODER | 20,218 | 4 |
Graphics
Now it was graphics’ turn. I used an image from GRELL & FALLA (it’s very intricate, so it made a good test). The block was 6,912 bytes long.
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 6,184 | 1 |
| PACK MAKER | 6,067 | 2 |
| TOMPACKER | 5,970 | 3 |
| TURBO IMPLODER | 5,964 | 4 |
Random bytes
To check which program could best compress complete nonsense—random bytes—I wrote a short BASIC program. It took a byte from ROM and multiplied it by the sine of a randomly chosen number (RND), then performed various multiplications, divisions, square roots and so on. This gave me 16 KB of “strange” bytes. To make an even bigger “mess”, I processed those 16 KB again using the same formula and appended the resulting block (another 16 KB) to the first one. That gave me 32,768 bytes to compress.
And which program handled it best?
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 32,488 | 1 |
| PACK MAKER | 28,447 | 4 |
| TOMPACKER | 32,411 | 2 |
| TURBO IMPLODER | 32,405 | 3 |
Animation frames
Since animation is often used in demos, I decided to capture several frames from the demo BRANCH OF MIND (ray-traced spheres). This gave me a block 34,560 bytes long.
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 6,554 | 4 |
| PACK MAKER | 10,248 | 1 |
| TOMPACKER | 9,490 | 2 |
| TURBO IMPLODER | 8,443 | 3 |
Text
As if that weren’t enough, I came up with the idea of testing something very close to my heart: text. The texts from ZX LAND 4 made a great test. I copied some of them—not all—and got a block 40,330 bytes long. Here are the results:
| Compressor | Compressed size | Points |
|---|---|---|
| IMPLODER | 25,977 | 3 |
| PACK MAKER | 23,087 | 4 |
| TOMPACKER | 26,527 | 1 |
| TURBO IMPLODER | 26,521 | 2 |
Overall score
For the best compression, a program received 4 points; second place got 3, third got 2, and last place got 1. The totals are:
- IMPLODER — 1+2+1+1+4+3 = 12
- PACK MAKER — 4+1+2+4+1+4 = 16
- TOMPACKER — 2+3+3+2+2+1 = 13
- TURBO IMPLODER — 3+4+4+3+3+2 = 19
As you can see, TURBO IMPLODER came out on top, but I would put it on a par with TOMPACKER. They have the same compression algorithm. The difference is due to the decompressor included with the compressed block being 6 bytes longer.
But there’s no point in going into that now. I’ll write about the advantages and disadvantages of these programs in the second part of the article.
Pyza
Share your thoughts about the article