#3113: Remove unnecessary slice in PacketDecompressor

Thanks @lokha for the profiling and suggestion.
This commit is contained in:
md_5 2021-06-13 08:32:20 +10:00
parent b7935d4b14
commit c57bf61114
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -31,8 +31,7 @@ public class PacketDecompressor extends MessageToMessageDecoder<ByteBuf>
int size = DefinedPacket.readVarInt( in ); int size = DefinedPacket.readVarInt( in );
if ( size == 0 ) if ( size == 0 )
{ {
out.add( in.slice().retain() ); out.add( in );
in.skipBytes( in.readableBytes() );
} else } else
{ {
ByteBuf decompressed = ctx.alloc().directBuffer(); ByteBuf decompressed = ctx.alloc().directBuffer();