title: Deflate and fixed Huffman codes
body: <p>I'm trying to implement a deflate compressor and I have to decide whether to
  compress a block using the static huffman code or create a dynamic one.</p>
  
  <p>What is the rationale behind the length associated with the static code?</p>
  
  <p>(this is the table included in the rfc)
  <code>
  Lit Value    Bits
  ---------    ----
    0 - 143     8
  144 - 255     9
  256 - 279     7
  280 - 287     8
  </code>
  I thought static code was more biased towards plain ascii text, instead it
  looks like it prefers by a tiny bit the compression of the rle length</p>
  
  <p>What is a good heuristic to decide whether to use static code?</p>
  
  <p>I was thinking to build a distribution of probabilities from a sample of the
  input data and calculate a distance (maybe EMD?) from the probabilities derived
  from the static code.</p>