Reading Compressed Data
For testing the reading performance, two files have been compressed with 5 different compression rates. Each test run performed 500 reading operations. For each read operation one of the 6 files was selected randomly. The measured times include the creation of the stream (including retrieving the entry of the Zip-File), creating a byte array to store the read bytes, the read operation of the complete file and finally closing the stream. The small file has a size of about 36 MB and the big one has a size about 398 MB. For compressing the data to Zip-Files the freeware program ZipGenius in the version 6.02.1060 (http://www.zipgenius.it) was used.
Test System
| Processor: | AMD Sempron 3000+ (2.0 MHz) |
| RAM: | 1024 MB |
| HDD: | Western Digital WD800BB 7200 RPM, 2 MB Cache, EIDE (Ultra ATA/100) |
| Operating System: | Windows XP (SP 2) |
The below-mentioned tables show the compression mode, the size of the compressed file, the number of performed tests on this file. The first row below the table header shows the corresponding values for the original file.
Performance Table for small file (36 MB)
| Compression | File Size (KB) | Num Tests | Average (ms) | Min (ms) | Max (ms) |
|---|---|---|---|---|---|
| Original File | 36893,734 | 73 | 235 | 218 | 266 |
| Zip (no compr.) | 36893,848 | 80 | 377 | 343 | 391 |
| Zip (low compr.) | 27659,438 | 93 | 1009 | 984 | 1032 |
| Zip (mid compr.) | 27406,668 | 85 | 988 | 969 | 1016 |
| Zip (high compr.) | 27406,668 | 83 | 987 | 969 | 1015 |
| Zip (brut compr.) | 27250,371 | 86 | 982 | 954 | 1063 |
Performance Table for big file (398 MB)
| Compression | File Size (KB) | Num Tests | Average (ms) | Min (ms) | Max (ms) |
|---|---|---|---|---|---|
| Original File | 398132,188 | 92 | 30186 | 8797 | 111593{ |
| Zip (no compr.) | 398132,281 | 85 | 51143 | 11594 | 333703 |
| Zip (low compr.) | 297377,625 | 79 | 27641 | 10296 | 137219 |
| Zip (mid compr.) | 292240,438 | 85 | 23722 | 10016 | 93875 |
| Zip (high compr.) | 291339,250 | 81 | 25875 | 10000 | 77297 |
| Zip (brut compr.) | 291339,250 | 78 | 20645 | 9984 | 68687 |

The conclusion of the performance test is that for small files compression slows down the read performance, but for big files it increases the speed.
For small files it is nearly unimportant which compression mode is chosen beside the No-Compression mode. Reading small zipped files costs about 1 second in the four modes low, mid, high and brutal.
For big files the speed increases by selecting a higher compression mode. Only the No-Compression mode slows the reading performance down.
The following tests have been made under the same conditions. But instead of reading the complete file, only three chunks have been read.
- The first chunk starts at the beginning of the file and has a length of 1024 byte.
- The second chunk starts at the middle of the file and has a size of 10240 byte.
- The third chunk starts at 2/3 of the file and has a size of 102 byte.
Performance Table for small file (36 MB)
| Compression | File Size (KB) | Num Tests | Average (ms) | Min (ms) | Max (ms) | Diff (1. - 2.) |
|---|---|---|---|---|---|---|
| Original File | 36893,734 | 82 | 593 | 500 | 625 | -358 |
| Zip (no compr.) | 36893,848 | 69 | 722 | 703 | 735 | -345 |
| Zip (low compr.) | 27659,438 | 74 | 941 | 922 | 969 | 68 |
| Zip (mid compr.) | 27406,668 | 84 | 931 | 907 | 969 | 57 |
| Zip (high compr.) | 27406,668 | 102 | 931 | 906 | 1094 | 56 |
| Zip (brut compr.) | 27250,371 | 89 | 925 | 906 | 953 | 57 |