square/okhttp — pull request #813 by adriancole (2014-05-09 15:55:37+00:00)
Title: Avoid double array-copy when Huffman decoding

I thought that it was over-polishing to take out the BAOS in Huffman, but actually, it can make a difference. We expect servers to use huffman with hpack in order to compress headers. If that's true, we will always call the huffman decoder for every value of a header we haven't seen, and any new header names not defined. Thinking of very volatile headers such as Date, I think huffman will be hit very often.

The lowest hanging fruit left is to eliminate copying the array from the BAOS twice, once as BAOS.toByteArray, and again constructing the ByteString.

Here's the results of this elimination, going against the huffman examples from the hpack spec.

Current code:
```
Benchmark Mode Samples Mean Mean error Units
c.s.o.i.s.Hpackers.okHttpHuffman thrpt 50 1241.927 17.834 ops/ms
```

This PR:
```
Benchmark Mode Samples Mean Mean error Units
c.s.o.i.s.Hpackers.okHttpHuffman thrpt 50 1330.627 16.040 ops/ms
```