3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Avoid calling writeVarInt in the (very) common uncompressed packet case

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-05-03 20:17:51 -04:00
Ursprung 0debb81392
Commit c041bea1b6

Datei anzeigen

@ -39,7 +39,7 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder<ByteBuf> {
int uncompressed = msg.readableBytes(); int uncompressed = msg.readableBytes();
if (uncompressed < threshold) { if (uncompressed < threshold) {
// Under the threshold, there is nothing to do. // Under the threshold, there is nothing to do.
ProtocolUtils.writeVarInt(out, 0); out.writeByte(0);
out.writeBytes(msg); out.writeBytes(msg);
} else { } else {
ProtocolUtils.writeVarInt(out, uncompressed); ProtocolUtils.writeVarInt(out, uncompressed);