mochilo is like msgpack, except that it deals with encodings in a
sane(r?) way. mochilo doesn't have a custom type registry, so I've added
one in the "custom-type-registry" branch, and I'm using that here.
This ended up being faster than the msgpack implementation, because
encoding doesn't have to pop up to ruby to deal with strings.
user system total real
BERT v2 tiny 0.010000 0.000000 0.010000 ( 0.015289)
BERT v2 small 0.130000 0.000000 0.130000 ( 0.126682)
BERT v2 large 0.580000 0.000000 0.580000 ( 0.592555)
BERT v2 complex 2.880000 0.010000 2.890000 ( 2.903082)
BERT v2 long array 4.200000 0.000000 4.200000 ( 4.262165)
BERT v3 tiny 0.020000 0.000000 0.020000 ( 0.020252)
BERT v3 small 0.020000 0.000000 0.020000 ( 0.024444)
BERT v3 large 0.700000 0.010000 0.710000 ( 0.703152)
BERT v3 complex 0.090000 0.000000 0.090000 ( 0.100372)
BERT v3 long array 1.810000 0.010000 1.820000 ( 1.827934)
BERT v4 tiny 0.010000 0.000000 0.010000 ( 0.013301)
BERT v4 small 0.010000 0.000000 0.010000 ( 0.012317)
BERT v4 large 0.230000 0.060000 0.290000 ( 0.292852)
BERT v4 complex 0.070000 0.000000 0.070000 ( 0.064578)
BERT v4 long array 0.110000 0.000000 0.110000 ( 0.110842)
Msgpack tiny 0.000000 0.000000 0.000000 ( 0.001644)
Msgpack small 0.010000 0.000000 0.010000 ( 0.002568)
Msgpack large 0.180000 0.000000 0.180000 ( 0.192238)
Msgpack complex 0.040000 0.000000 0.040000 ( 0.041482)
Msgpack long array 0.070000 0.000000 0.070000 ( 0.065986)
Don't reinvent this particular wheel. There's still a mention or two of
`.bundle` which is what we have on OS X. So some of the cleaning up
just did not work on anything else.
This method will buffer writes, but to an array rather than to a
StringIO. This allows us to calculate the size of the BERT packet that
we're going to send *without* copying large strings in to a new buffer.
Writes might take a bit more CPU, but will take fare less memory.