Try to reduce JNI calls into compressor.

Comparatively speaking, JNI calls are very expensive, so we want to
reduce them as much as possible.
This commit is contained in:
Andrew Steinborn
2019-01-10 21:10:00 -05:00
parent e240dac55b
commit 1ddeb85f60
2 changed files with 4 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ public class NativeVelocityCompressor implements VelocityCompressor {
int produced = deflate.process(deflateCtx, source.memoryAddress() + source.readerIndex(),
source.readableBytes(),
destination.memoryAddress() + destination.writerIndex(), destination.writableBytes(),
!source.isReadable());
true);
source.readerIndex(source.readerIndex() + deflate.consumed);
destination.writerIndex(destination.writerIndex() + produced);
}