title: How to determine the compression level of DEFLATE?
body: <p>There are ten different compression levels for DEFLATE (0 no compression &amp; fastest, 9 best compression &amp; slowest). What is the best way to determine such level for a raw DEFLATE data?</p>
  
  <p>One obvious (yet slow) method would be to try each and compare sequentially. As a side question, is it guaranteed that the size of compressed data for a file is strictly non-increasing going from compression level 0 to 9? If so, binary search can speed up this procedure by a factor of two/three.</p>