[Zlib-devel] zlib compiled with -DFASTEST

Petr Sumbera petr.sumbera at oracle.com
Wed Nov 9 07:52:04 EST 2011


Hi,

can somebody please help me to understand what exactly changes when 
FASTEST is defined during compilation? I'm interested if there are some 
limitation or incompatibilities. And if not why it's not allowed to 
chose this method during runtime not just during compilation.

I did have look at sources (version 1.2.3) and see following:

With FASTEST:
- no compilation of longest_match() and deflate_slow()
   (note that there is still longest_match_fast() and deflate_fast()
- deflateInit2_() and deflateParams() set always level to 1
   (normally there are levels 1-9: 1-3 uses delfate_fast(), 4-9: uses 
deflate_slow()
- deflate_fast() will use longest_match_fast() in both cases

Without FASTEST:
- fill_window(), deflate_fast() and INSERT_STRING macro maintain hash 
chains.

I did also some speed comparison between version compiled with FASTEST 
and normal ZLIB with compression level set to 1 (It was tested on 73MB 
tar archive with compiled Wireshark):

ZLIB (lowest compression):     1.692s (compress ratio: 0.26)
ZLIB compiled with -DFASTEST:  1.176s (compress ratio: 0.29)

I played little bit with the sources and was able to make it tunable by 
global variable 'fastest'. It would probably require new API init 
functions for changing zlib to fastest deflate mode. Please see attached 
patch against version 1.2.3. Also ASMV definition would have to be cared 
better.

Can I get any comments?

Thanks,

Petr
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: deflate.patch
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20111109/4781a4b8/attachment.ksh>


More information about the Zlib-devel mailing list