Are there any strategies (or libraries) for performant varints and varlongs in Java?
<p>Currently, I am serializing some long data using <code>DataOutput.writeLong(long)</code>. The issue with this is obvious: there are many many cases where the longs will be quite small. I was wondering what the most performant varint implementation is? I've seen the strategy from protocol buffers, and testing on Random long data (which probably isn't the right distribution to test against), I'm seeing a pretty big performance drop (about 3-4x slower). Is this to be expected? Are there any good strategies for serializing longs as quickly as possible while still saving space?</p>

<p>Thanks for your help!</p>
