In both Velocity and BungeeCord, the most commonly created object is an
object that encapsulates a Minecraft packet and a its associated byte
data.
At first, I considered trying to recycle these objects, but then I
discovered that this object has no reason to exist, and actually somewhat
complicates the implementation. Thus, this commit removes these objects,
making Velocity more more GC-friendly by not allocating frequently-created
objects.
This is still an experimental change, but it's a fairly safe one to make.
I considered using composite byte buffers but they would have added GC
overhead and would've been incompatible with any native code we added
unless special care was taken.
This has the potential to cut the time that players spend at the
"logging in..." (or "encrypting..." for 1.13+) screen by a fair
amount (gains of 200+ ms were noted for my own home connection).
While this sounds minor, I really do like to aim for all the details
and this is one of them.
- Potentially fixed a reference count leak with plugin messages.
- Cleaned up plugin message handling.
- Optimized the pipeline for better throughput by eliminating copying
in the varint encoder and reduced object churn elsewhere.