[Python-bugs-list] [ python-Bugs-785222 ] zlib monotonic test --
false assumptions or bug in zlib.lib
SourceForge.net
noreply at sourceforge.net
Wed Aug 13 23:39:02 EDT 2003
Bugs item #785222, was opened at 2003-08-08 09:35
Message generated for change (Comment added) made by prikryl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=785222&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Petr Prikryl (prikryl)
Assigned to: Nobody/Anonymous (nobody)
Summary: zlib monotonic test -- false assumptions or bug in zlib.lib
Initial Comment:
Hi,
This bug was observed for Python 2.3c1, but probably is
the same in Python 2.3 final.
I have discovered (by accident) that the assumption in
test_zlib.py, class CompressTestCase, test_monotonic()
or build on a false assumption ("higher compression
levels should not expand compressed size"), or the zlib
version 1.1.4 contains a bug.
The test fails when the hamlet_scene sample is modified.
Try to remove the empty line from the very beginning of
the sample. Then the results for level 2 is better that for
level 3 and the result for the level 4 is better than for
level 5. The compressed sizes are:
level=0, length=245801
level=1, length=5325
level=2, length=4946
level=3, length=6052
level=4, length=2750
level=5, length=2769
level=6, length=2751
level=7, length=2388
level=8, length=2388
level=9, length=2388
Petr
----------------------------------------------------------------------
>Comment By: Petr Prikryl (prikryl)
Date: 2003-08-14 07:39
Message:
Logged In: YES
user_id=771873
I did ask the authors of zlib. It seems that everything is fine
except the assumption about "bigger is better" which seems
natural at first ;-) The monotonic test should add some
comment that it may fail. See below:
On Wednesday, August 13, 2003, at 01:45 AM, Petr Prikryl
wrote:
> My question is: Are the assumptions about the monotonic
> results correct? In other words, is the Python test correct,
> or is the implementation of the Python wrapper correct
> (i.e. of the enclosed C code), or is there a bug in the
> implementation of deflate()?
[and Mark Adler answered]
It's a feature. There is no problem with deflate or with the
Python wrapper. The compression results, especially on small
files, are not necessarily monotonic with compression level.
The compression level determines how hard deflate looks for
longer matches. However slightly longer matches do not
always improve the compression, since it takes more bits to
encode the longer distances back those matches occur.
mark
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=785222&group_id=5470
More information about the Python-bugs-list
mailing list