Software‎ > ‎

DeflateRunner

Description

Offline performance analysis for zlib (gzip format). Compress a given file with deflate algorithm , in order to test the compression ratio and speed for all possible compression levels (1-9).

Download

File Version Date Comments
DeflateRunner.jar 1.0 23-Oct-2012

Running

Usage: DeflateRunner.jar file [levels-analysis-requests-step]

Example:

# wget "http://www.wpost.com/" -O /tmp/1.html

# java -jar DeflateRunner.jar /tmp/1.html

Level  Compressed  Time_uSec  Raw_Mbps  Net_Save  Time_Add  mSec_Save_MB
0         184,470      868.9   1,698.4     0.00%      0.0%           0.0
1          41,821    2,480.3     595.0     0.00%      0.0%          11.3
2          40,532    2,641.4     558.7     3.08%      6.5%          12.3
3          39,581    2,754.8     535.7     5.36%     11.1%          13.0
4          36,851    4,235.9     348.4    11.88%     70.8%          22.8
5          35,605    5,452.3     270.7    14.86%    119.8%          30.8
6          35,013    5,808.2     254.1    16.28%    134.2%          33.0
7          34,976    6,354.5     232.2    16.37%    156.2%          36.7
8          34,930    7,566.0     195.1    16.48%    205.0%          44.8
9          34,929    7,941.9     185.8    16.48%    220.2%          47.3


The results are presented in the 3 leftmost columns:
  • Level - Tested zlib compression level. Zero means no compression, but it still calls the library code.
  • Compressed - Output size, no including the gzip header and footer (18 bytes).
  • Time_uSec - The time in micro-seconds it takes to compress a single copy, using a single CPU core (no parallelism).
The other columns are calculations presented for the user's convenience only - they derive from the size and time columns mentioned above:
  • Raw_Mbps - Theoretical maximal speed using a single CPU core, expressed in mega-bits-per-second.
  • Net_Save - How much of the bandwidth used by level 1 can be saved. Not relevant to levels 0 and 1, but printed for proper alignment and post processing.
  • Time_Add - How much time is added relative to level 1. Not relevant to levels 0 and 1, but printed for proper alignment and post processing.
  • mSec_Save_MB - How much time it takes to save a MB (mega byte) of traffic, using a single CPU core, following the results presented above.

Technical

The file is loaded to memory first, and then it is being compressed as a single complete buffer.
Compression strategy is set to default: Deflate with Huffman.
For each level it compresses the file repeatedly in memory until at least 200 mSec pass. Then it calculates how long a single compression took (average) and it presents it in 'Time_uSec' and 'Speed_Mbps' comlumns.
The column 'L1_Gain' is relevant for levels 2-9 only as it shows how many bytes were reduced when comparing to the level 1 output. Similarly, the column 'Time_Add' tells how much time was "paid" to get the higher ratio.
Output can be easily imported to Excel, using space as a delimiter and marking "merge multiple delimiters".
There is one optional enhancement to the basic operation: it can also calculate the optimal level(s) to use under a strict CPU budget.
To present the optimization calculations, one need to set the "levels-analysis-requests-step" parameter to a reasonable value, like 1 or 5 (for example).