Delegate byte[] allocation to ByteBuffer
Rename ensureCapacity -> ensureRemainingCapacity
Only grow capacity 50% at a time

This reduces the amount of worst-case extra allocation by 50%.

In the worst case, this increases the number of copies with about 71%
and the total number of bytes copied by about 50%.
Align buffer sizes with cache line sizes

Initial buffer size occupies a full cache line, and subsequent growth
is pushed to the next full cache line.

As a side effect, this causes initial expansions to be well beyond
50% increase. In particular, the first growth is 260%, but we are
down to 60% at 500 total bytes, and 50% at about 25k bytes.
Support multiple packed reps in msgpack spec

Several Ruby integer values can be packed in different ways.
Update large/huge integers with more edge cases
Check that bignums are actually encodable
Use named constants instead of magic numbers
Never pack a java long as UINT64

Unpacking INT64 is faster, and a long is guaranteed to fit in INT64.
Balance the branch-tree in encodeInteger

Before, it was a straight line of branches, which meant that the
number of branches (the branch depth) required before reaching varied
between 1 and 9, like this:

[-1 << 63, -1 << 31) => 1
[-1 << 31, -1 << 15) => 2
[-1 << 15, -1 <<  7) => 3
[-1 <<  7, -1 <<  5) => 4
[-1 <<  5,        0) => 5
[0       ,  1 <<  7) => 6
[ 1 <<  7,  1 <<  8) => 7
[ 1 <<  8,  1 << 16) => 8
[ 1 << 16,  1 << 32) => 9
[ 1 << 32,  1 << 63) => 9

This balances the branch tree, making it three or four branches deep
for every case:

[-1 << 63, -1 << 32) => 3
[-1 << 32, -1 << 16) => 3
[-1 << 16, -1 <<  8) => 4
[-1 <<  8, -1 <<  5) => 4
[-1 <<  5,        0) => 3
[0       ,  1 <<  7) => 3
[ 1 <<  7,  1 <<  8) => 4
[ 1 <<  8,  1 << 16) => 4
[ 1 << 16,  1 << 32) => 3
[ 1 << 32,  1 << 64) => 3
Use RubyHash.Visitor to enumerate Hash entries

Avoid allocation of key and value arrays.

Also protect against concurrent modification of the hash.
Use RubyArray#eltOk instead of RubyArray#entry

We don't want translation of negative indices.
Decode also the range types through switch tables