Fix a few areas of concern spotted by JITWatch

This commit is contained in:
Andrew Steinborn
2020-06-27 21:33:05 -04:00
parent 7e1f01f13a
commit 62703780e1
3 changed files with 1 additions and 5 deletions

View File

@@ -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);
}