Recently the subject of compression algorithms was raised on Twitter, and a number of new additions to the field were mentioned in the ensuing discussion. As I’m currently working on improving load times for a project, these newcomers piqued my interest and I set out to do some evaluation of them with “game-ish” assets.

This was originally posted on Technofumbles, which may have better formatting for the tables; if the layout is too messed up here, try the original post.

I haven’t been able to test every algorithm I wanted to get to yet (new and old), and only have PC results to show so far – but am releasing the source so it can be extended as people desire. See the end of the post for a download link. Future algorithms on my list to add to the test suite are ZLib, lzham, LZMA, and a few variants there of.

UPDATE April 24, 2011: LZ4 has been open-sourced, so I’ve added it to the test suite and updated the results. Charts have also been added to make comparison easier.

The test data I chose came mainly from the DirectX SDK samples, with a few files that were kicking around my hard drive for good measure. Highly scientific! I hope to do more realistic tests soon!

Tests were performed on a low-end Core2 Duo laptop. Without further delays, here’s the numbers.

Summary Results:


Compression Ratio (click to enlarge):

Compression Time (click to enlarge):

Compression Time, Zoomed (click to enlarge):

Decompression Time (click to enlarge):

Decompression Time, Zoomed (click to enlarge):

Summary Results:

Algorithm

% (Average)

Compression Time (Total)

Decompression Time (Total)

Doboz 66.609 38.26463 0.24643
Yappy 76.616 1.83406 0.10750
Snappy 73.838 0.51189 0.20106
LZF 72.293 0.73531 0.20450
FastLZ 73.105 0.89960 0.25096
QuickLZ 73.373 0.44819 0.29023
LZ4 71.743 0.52270 0.13279

 

Compression Details:

  Doboz Yappy
File Type % S % S
BMP 76.859 0.28196 100.511 0.01840
BMP 15.771 2.04379 39.693 0.08194
DDS 92.847 2.71034 98.261 0.13022
DDS 100.000 1.15703 102.474 0.06402
DDS 30.457 0.38021 37.101 0.01224
DDS 58.066 1.63392 78.431 0.07035
DDS 77.604 0.21672 85.799 0.01651
DDS 38.272 0.32217 45.296 0.01378
DDS 75.037 2.75669 98.596 0.09562
DDS 50.520 2.97517 81.242 0.09691
DDS 38.885 0.07744 46.294 0.00358
DDS 98.550 0.04572 100.713 0.00609
DDS 46.584 7.37891 72.888 0.28009
X 17.017 0.05599 28.431 0.00297
JPG 100.001 0.15212 101.159 0.02035
PDF 100.000 0.61228 102.308 0.06216
PDF 100.000 5.26727 98.232 0.36000
PNG 100.032 0.00551 101.561 0.00038
PNG 100.018 0.00658 101.584 0.00065
MESH 30.941 0.16696 47.942 0.01962
ANIM 20.349 0.08969 23.585 0.00349
SMD 8.705 0.81705 28.595 0.02770
TXT 36.946 0.01829 54.240 0.00270
TXT 36.000 0.00952 49.461 0.00078
HDR 85.190 3.04351 97.053 0.11724
WAV 100.000 1.34706 95.849 0.09014
WAV 100.000 0.98768 99.833 0.07076
WAV 97.022 2.64150 102.726 0.10698
WAV 100.000 0.83595 102.019 0.06339
  Snappy LZF
File Type % S % S
BMP 98.494 0.00494 86.235 0.00886
BMP 34.023 0.02537 42.279 0.01739
DDS 97.980 0.04788 95.804 0.06335
DDS 99.956 0.00500 100.229 0.02882
DDS 36.008 0.00356 33.066 0.00441
DDS 76.513 0.04170 70.303 0.02679
DDS 86.051 0.00662 82.233 0.00726
DDS 44.553 0.00433 42.180 0.00441
DDS 96.407 0.03740 86.483 0.04520
DDS 76.097 0.05383 68.093 0.03548
DDS 45.953 0.00131 43.822 0.00149
DDS 98.711 0.00064 97.998 0.00281
DDS 68.686 0.15584 62.146 0.09891
X 25.919 0.00096 26.458 0.00067
JPG 97.265 0.00130 100.833 0.00837
PDF 98.477 0.00447 101.311 0.02401
PDF 95.421 0.03683 97.329 0.14390
PNG 99.440 0.00006 101.189 0.00036
PNG 99.958 0.00005 100.406 0.00037
MESH 41.180 0.00460 40.191 0.00450
ANIM 22.804 0.00068 21.442 0.00069
SMD 19.854 0.00573 15.934 0.00462
TXT 51.544 0.00083 49.048 0.00067
TXT 45.939 0.00033 45.320 0.00032
HDR 94.695 0.03526 91.182 0.05647
WAV 93.265 0.01055 94.968 0.04045
WAV 97.076 0.00619 99.201 0.02845
WAV 99.861 0.00718 99.541 0.04940
WAV 99.176 0.00445 101.271 0.02595
  FastLZ QuickLZ
File Type % S % S
BMP 90.305 0.01170 91.482 0.00714
BMP 41.562 0.02124 49.502 0.01913
DDS 97.465 0.08657 100.000 0.02873
DDS 101.011 0.03795 100.000 0.01411
DDS 33.720 0.00467 33.060 0.00449
DDS 74.448 0.03656 69.147 0.02293
DDS 85.192 0.01019 87.021 0.00553
DDS 43.315 0.00570 42.407 0.00355
DDS 89.005 0.05589 86.723 0.03342
DDS 70.850 0.04215 69.727 0.02931
DDS 45.153 0.00162 43.871 0.00100
DDS 98.450 0.00313 100.003 0.00219
DDS 67.313 0.11819 64.563 0.07868
X 25.687 0.00079 24.202 0.00057
JPG 99.935 0.00988 100.001 0.00424
PDF 101.166 0.02915 100.000 0.01258
PDF 97.352 0.17365 100.000 0.07601
PNG 101.303 0.00018 100.057 0.00008
PNG 100.720 0.00032 100.032 0.00013
MESH 36.532 0.00609 37.332 0.00426
ANIM 20.880 0.00087 21.235 0.00069
SMD 14.640 0.00526 14.675 0.00456
TXT 49.004 0.00062 47.658 0.00044
TXT 45.977 0.00024 45.105 0.00019
HDR 93.522 0.06468 100.000 0.02546
WAV 95.033 0.04300 100.000 0.01853
WAV 99.288 0.03458 100.000 0.01526
WAV 99.819 0.05917 100.000 0.02266
WAV 101.391 0.03263 100.000 0.01352
  LZ4
File Type % S
BMP 92.720 0.01104
BMP 36.492 0.01010
DDS 93.103 0.07531
DDS 98.942 0.02954
DDS 31.981 0.00348
DDS 69.793 0.02250
DDS 79.072 0.00957
DDS 40.509 0.00522
DDS 86.819 0.04902
DDS 73.269 0.02903
DDS 42.889 0.00134
DDS 97.659 0.00189
DDS 66.108 0.06883
X 26.743 0.00113
JPG 97.413 0.00170
PDF 98.492 0.00430
PDF 95.267 0.03972
PNG 99.276 0.00040
PNG 99.086 0.00063
MESH 38.591 0.00512
ANIM 20.849 0.00152
SMD 15.971 0.00518
TXT 51.581 0.00079
TXT 49.976 0.00052
HDR 89.331 0.06100
WAV 93.001 0.01503
WAV 97.113 0.00956
WAV 99.146 0.05368
WAV 99.346 0.00570

 

Decompression Details:

  Doboz Yappy Snappy
File Type S S S
BMP 0.00540 0.00067 0.00114
BMP 0.00757 0.00556 0.01270
DDS 0.02847 0.00675 0.01048
DDS 0.00452 0.00294 0.00359
DDS 0.00114 0.00053 0.00110
DDS 0.01542 0.00680 0.01513
DDS 0.00218 0.00075 0.00156
DDS 0.00132 0.00055 0.00124
DDS 0.02774 0.00535 0.01060
DDS 0.01797 0.00713 0.01974
DDS 0.00040 0.00017 0.00040
DDS 0.00074 0.00029 0.00021
DDS 0.04511 0.02750 0.05855
X 0.00023 0.00017 0.00034
JPG 0.00059 0.00054 0.00118
PDF 0.00260 0.00249 0.00308
PDF 0.02046 0.01731 0.02017
PNG 0.00001 0.00001 0.00001
PNG 0.00001 0.00001 0.00001
MESH 0.00197 0.00085 0.00284
ANIM 0.00019 0.00013 0.00129
SMD 0.00214 0.00180 0.00479
TXT 0.00020 0.00012 0.00029
TXT 0.00009 0.00005 0.00012
HDR 0.03745 0.00647 0.01246
WAV 0.00334 0.00302 0.00409
WAV 0.00269 0.00242 0.00431
WAV 0.02631 0.00529 0.00710
WAV 0.00233 0.00221 0.00455
  LZF FastLZ QuickLZ
File Type S S S
BMP 0.00276 0.00416 0.00679
BMP 0.01091 0.01349 0.01799
DDS 0.01478 0.01770 0.00538
DDS 0.00542 0.00613 0.00290
DDS 0.00107 0.00126 0.00243
DDS 0.01122 0.01429 0.02223
DDS 0.00187 0.00234 0.00536
DDS 0.00129 0.00157 0.00305
DDS 0.01678 0.02031 0.03722
DDS 0.01649 0.01970 0.03277
DDS 0.00041 0.00047 0.00082
DDS 0.00054 0.00067 0.00011
DDS 0.04369 0.05458 0.08630
X 0.00036 0.00040 0.00047
JPG 0.00092 0.00119 0.00057
PDF 0.00403 0.00379 0.00221
PDF 0.02469 0.02823 0.01733
PNG 0.00002 0.00002 0.00001
PNG 0.00003 0.00004 0.00001
MESH 0.00192 0.00213 0.00528
ANIM 0.00019 0.00021 0.00049
SMD 0.00292 0.00324 0.00441
TXT 0.00025 0.00134 0.00041
TXT 0.00032 0.00013 0.00017
HDR 0.01578 0.01920 0.00687
WAV 0.00485 0.00668 0.02031
WAV 0.00393 0.00441 0.00260
WAV 0.01349 0.02018 0.00550
WAV 0.00467 0.00572 0.00242
  LZ4
File Type S
BMP 0.00145
BMP 0.00668
DDS 0.00939
DDS 0.00319
DDS 0.00075
DDS 0.00831
DDS 0.00107
DDS 0.00086
DDS 0.01101
DDS 0.01046
DDS 0.00026
DDS 0.00021
DDS 0.03002
X 0.00026
JPG 0.00086
PDF 0.00276
PDF 0.01641
PNG 0.00001
PNG 0.00002
MESH 0.00128
ANIM 0.00013
SMD 0.00228
TXT 0.00017
TXT 0.00009
HDR 0.01020
WAV 0.00393
WAV 0.00239
WAV 0.00535
WAV 0.00250

 

Current source can be grabbed here (mostly platform-agnostic test suite library with a C# GUI and C++/CLI for interop):
GitHub: