Fix a few areas of concern spotted by JITWatch
This commit is contained in:
@@ -41,8 +41,7 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder<ByteBuf> {
|
||||
// Follow the advice of https://github.com/ebiggers/libdeflate/blob/master/libdeflate.h#L103
|
||||
// here for compression. The maximum buffer size if the data compresses well (which is almost
|
||||
// always the case) is one less the input buffer.
|
||||
int offset = msg.readableBytes() < threshold ? 1 : -1;
|
||||
int initialBufferSize = msg.readableBytes() + offset;
|
||||
int initialBufferSize = msg.readableBytes() + 1;
|
||||
return MoreByteBufUtils.preferredBuffer(ctx.alloc(), compressor, initialBufferSize);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user