Switch out Cloudflare zlib for libdeflate.
libdeflate is significantly faster than vanilla zlib, zlib-ng, and Cloudflare zlib. It is also MIT-licensed (so no licensing concerns). In addition, it simplifies a lot of the native code (something that's been tricky to get right). While we're at it, I have also taken the time to fine-time compression in Velocity in general. Thanks to this work, native compression only requires one JNI call, an improvement from the more than 2 (sometimes up to 5) that were possible before. This optimization also extends to the existing Java compressors, though they require potentially two JNI calls.
This commit is contained in:
@@ -86,10 +86,11 @@ class VelocityCompressorTest {
|
||||
ByteBuf decompressed = bufSupplier.get();
|
||||
|
||||
source.writeBytes(TEST_DATA);
|
||||
int uncompressedData = source.readableBytes();
|
||||
|
||||
try {
|
||||
compressor.deflate(source, dest);
|
||||
compressor.inflate(dest, decompressed, Integer.MAX_VALUE);
|
||||
compressor.inflate(dest, decompressed, uncompressedData);
|
||||
source.readerIndex(0);
|
||||
assertTrue(ByteBufUtil.equals(source, decompressed));
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user