Game Boy Compression Playground
Meet Cenotaph! My testing subject for comparision presented below.
Besides visual quality this picture presents quite good data sample for compression tests. After processing it with bmp2cgb I ended up with usual attribute, tile and map files. Each file has its own characteristics. Attributes contain repeating strings, tiles have a bit of everything and map is the toughest nut, containing mostly unique bytes. Each file has been packed and then unpacked in emulated environment to count exact amount of cycles used. I've also included information about unpacker size, memory usage and possible file size reduction by striping obsolete header data where possible. Results are as follows:
| Method | Size | Ratio | Cycles | Unpacker | RAM | HRAM | Header |
|---|---|---|---|---|---|---|---|
| Raw data | 360 | 100% | 14452 | - | - | - | - |
| 4000 | 100% | 160220 | |||||
| 360 | 100% | 14452 | |||||
| aPack | 152 | 42.22% | 77252 | 227 | - | 4 | 24 |
| 3090 | 77.25% | 947216 | |||||
| 344 | 95.55% | 71272 | |||||
| C64Pack v1.0 | 162 | 45% | 48644 | 349 | - | 9 | 1 |
| 3185 | 79.62% | 772608 | |||||
| 332 | 92.22% | 69380 | |||||
| GB Compress v1.4 | 222 | 61.66% | 17064 | 250 | - | - | - |
| 3448 | 86.20% | 160608 | |||||
| 339 | 94.16% | 12544 | |||||
| gb-lzss | 196 | 54.44% | 27068 | 44 | - | 1 | - |
| 3575 | 89.37% | 289296 | |||||
| 372 | 103.33% | - | |||||
| HAL Laboratory compression | 193 | 53.61% | 42712 | 202 | - | 2 | - |
| 3305 | 82.65% | 517160 | |||||
| 122 | 33.88% | 42244 | |||||
| LZ4 | 242 | 67.22% | 36572 | 77 | - | 3 | 11 |
| 3388 | 84.70% | 317852 | |||||
| 359 | 99.72% | 24200 | |||||
| LZ4GB | 221 | 61.38% | 26240 | 78 | - | - | - |
| 3370 | 84.25% | 223964 | |||||
| 342 | 95% | 16676 | |||||
| PuCrunch | 160 | 44.44% | 125976 | 428 | 43 | 1 | - |
| 3083 | 77.07% | 2267160 | |||||
| 335 | 93.05% | 228392 | |||||
| RNC (method 1) | 173 | 48.05% | 464760 | 1033 | 400 | 30 | 17 |
| 3062 | 76.55% | 3257216 | |||||
| 354 | 98.33% | 244172 | |||||
| RNC (method 2) | 183 | 50.83% | 31520 | 228 | - | - | 18 |
| 3160 | 79% | 303212 | |||||
| 360 | 100% | - | |||||
| SWD32 | 169 | 46.94% | 55652 | 231 | - | - | 12 |
| 3219 | 80.47% | 488228 | |||||
| 374 | 103.88% | - | |||||
13 Jul 2020:
aPack unpacker added. PuCrunch loses its place.
26 May 2019:
As you can see there's no clear winner. Compression was always about speed vs. size and it's no different here. RNC method 1 does the best job packing tile data but unoptimized unpacker is slowest, largest and needs a lot of RAM. PuCrunch is second being 21 bytes behind but wins when it comes to attributes file. Then we have C64Pack, just 2 bytes behind PuCrunch. Map file was too much for gb-lzss, RNC method 2 and SWD32 which failed miserably. Surprisingly kirbyLzRle, which uses mixed LZ-RLE based on HAL Laboratory packer, wins hand down here. GB Compress wins honorable mention being the fastest - apparently unpacking map file is faster than copying it usual way! 😲