]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compression: optimize memLevel to improve byte rate
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Oct 2012 09:36:40 +0000 (11:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Oct 2012 09:36:40 +0000 (11:36 +0200)
Decreasing the deflateInit2's memLevel parameter from 9 to 8 does not
affect the compression ratio and increases the compression speed by 12%.
Lower values do not increase transfer speed but decrease the compression
ratio so it looks like 8 is optimal.

src/compression.c

index 87449acf12b47a7625e8e9a5876b8b49eebb5819..45244a075d6a998402395b2b38641bfea2bc86f8 100644 (file)
@@ -317,7 +317,7 @@ int gzip_init(void *v, int level)
        strm->zfree = Z_NULL;
        strm->opaque = Z_NULL;
 
-       if (deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS + 16, 9, Z_DEFAULT_STRATEGY) != Z_OK)
+       if (deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS + 16, 8, Z_DEFAULT_STRATEGY) != Z_OK)
                return -1;
 
        return 0;