geforkt von Mirrors/Velocity
Fix a few areas of concern spotted by JITWatch
Dieser Commit ist enthalten in:
Ursprung
7e1f01f13a
Commit
62703780e1
@ -48,8 +48,6 @@ public class LibdeflateVelocityCompressor implements VelocityCompressor {
|
|||||||
@Override
|
@Override
|
||||||
public void deflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
public void deflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
||||||
ensureNotDisposed();
|
ensureNotDisposed();
|
||||||
source.memoryAddress();
|
|
||||||
destination.memoryAddress();
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
long sourceAddress = source.memoryAddress() + source.readerIndex();
|
long sourceAddress = source.memoryAddress() + source.readerIndex();
|
||||||
|
@ -31,7 +31,6 @@ public class NativeVelocityCipher implements VelocityCipher {
|
|||||||
@Override
|
@Override
|
||||||
public void process(ByteBuf source) {
|
public void process(ByteBuf source) {
|
||||||
ensureNotDisposed();
|
ensureNotDisposed();
|
||||||
source.memoryAddress();
|
|
||||||
|
|
||||||
long base = source.memoryAddress() + source.readerIndex();
|
long base = source.memoryAddress() + source.readerIndex();
|
||||||
int len = source.readableBytes();
|
int len = source.readableBytes();
|
||||||
|
@ -41,8 +41,7 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder<ByteBuf> {
|
|||||||
// Follow the advice of https://github.com/ebiggers/libdeflate/blob/master/libdeflate.h#L103
|
// 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
|
// here for compression. The maximum buffer size if the data compresses well (which is almost
|
||||||
// always the case) is one less the input buffer.
|
// always the case) is one less the input buffer.
|
||||||
int offset = msg.readableBytes() < threshold ? 1 : -1;
|
int initialBufferSize = msg.readableBytes() + 1;
|
||||||
int initialBufferSize = msg.readableBytes() + offset;
|
|
||||||
return MoreByteBufUtils.preferredBuffer(ctx.alloc(), compressor, initialBufferSize);
|
return MoreByteBufUtils.preferredBuffer(ctx.alloc(), compressor, initialBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren