For Programmers: Free Programming Magazines  


Home > Archive > Compression > March 2007 > memLevel settings for zlib









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author memLevel settings for zlib
byaarov@yahoo.com

2007-03-26, 6:55 pm

It is not clear to me from reading zlib.h, what values of memLevel do
on compression ratios. It does mention that a value of 1 uses min
memory and reduces compression rations, and says memLevel = 9 uses max
memory for best speed... but does that also mean that a memLevel of 9
is best compression ratios?

Mark Adler

2007-03-28, 3:56 am

On Mar 26, 3:47 pm, byaa...@yahoo.com wrote:
> but does that also mean that a memLevel of 9
> is best compression ratios?


No. In fact, memLevel 8 often (but not always) gives better
compression than memLevel 9, which is why 8 is the default.

The reason is that the memLevel determines how often deflate blocks
are emitted, which controls how rapidly the Huffman codes for each
block can adapt to changes in the statistics of the data. So you can
win with more adaptive codes, but then you can lose if you push that
too far, and the overhead of the code descriptions more than cancels
the gain of the better codes.

How often to adapt is highly data dependent.

Mark

byaarov@yahoo.com

2007-03-28, 3:56 am

On Mar 27, 9:27 pm, "Mark Adler" <mad...@alumni.caltech.edu> wrote:
> On Mar 26, 3:47 pm, byaa...@yahoo.com wrote:
>
>
> No. In fact, memLevel 8 often (but not always) gives better
> compression than memLevel 9, which is why 8 is the default.
>
> The reason is that the memLevel determines how often deflate blocks
> are emitted, which controls how rapidly the Huffman codes for each
> block can adapt to changes in the statistics of the data. So you can
> win with more adaptive codes, but then you can lose if you push that
> too far, and the overhead of the code descriptions more than cancels
> the gain of the better codes.
>
> How often to adapt is highly data dependent.
>
> Mark



That makes sense... same reason why too large a window size in BWT may
yield worse results I guess

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com