Velocity icon indicating copy to clipboard operation
Velocity copied to clipboard

Pass compressed packets directly to the backend server/client

Open JNNGL opened this issue 1 year ago • 4 comments

This passes compressed packets that are not present in the packet registry to the backend server/client without decompressing/recompressing them whenever possible; only the first 5 bytes are decompressed to get the packet id.

JNNGL avatar Sep 07 '23 09:09 JNNGL

This has been proposed many times. By all means, this is not a bad idea. My main concern is that it could introduce overhead from decompressing to check the packet ID. zlib decompression is actually really cheap, the actual CPU-intensive part is compressing the packet. Personally, I would rather have Mojang pull out the packet ID from compressed packets, but the window to do that was in 2013 and that's well past us now.

astei avatar Oct 27 '23 05:10 astei

My main concern is that it could introduce overhead from decompressing to check the packet ID.

Wouldn't that still be faster than recompressing every packet?

JNNGL avatar Oct 30 '23 13:10 JNNGL

Wouldn't that still be faster than recompressing every packet?

Compressing small packets is still pretty cheap.

Could we have a carveout for packets with a compressed size lower than, say, 2048 bytes? Larger packets will benefit from this much more than smaller packets.

astei avatar Oct 30 '23 18:10 astei

Maybe make a configurable amount

ytnoos avatar Oct 30 '23 18:10 ytnoos