From c57bf61114dc3c8e4b5e148f25d3afc8eb15d832 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 13 Jun 2021 08:32:20 +1000 Subject: [PATCH] #3113: Remove unnecessary slice in PacketDecompressor Thanks @lokha for the profiling and suggestion. --- .../main/java/net/md_5/bungee/compress/PacketDecompressor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/compress/PacketDecompressor.java b/proxy/src/main/java/net/md_5/bungee/compress/PacketDecompressor.java index 21b3ea2b..e239b980 100644 --- a/proxy/src/main/java/net/md_5/bungee/compress/PacketDecompressor.java +++ b/proxy/src/main/java/net/md_5/bungee/compress/PacketDecompressor.java @@ -31,8 +31,7 @@ public class PacketDecompressor extends MessageToMessageDecoder int size = DefinedPacket.readVarInt( in ); if ( size == 0 ) { - out.add( in.slice().retain() ); - in.skipBytes( in.readableBytes() ); + out.add( in ); } else { ByteBuf decompressed = ctx.alloc().directBuffer();