Use automatica Zstd buffer pooling
This commit is contained in:
+2
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.util.objects.dataStreams;
|
||||
|
||||
import com.github.luben.zstd.RecyclingBufferPool;
|
||||
import com.github.luben.zstd.ZstdInputStream;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import net.jpountz.lz4.LZ4FrameInputStream;
|
||||
@@ -51,7 +52,7 @@ public class DhDataInputStream extends DataInputStream
|
||||
case LZ4:
|
||||
return new LZ4FrameInputStream(stream);
|
||||
case Z_STD:
|
||||
return new ZstdInputStream(stream);
|
||||
return new ZstdInputStream(stream, RecyclingBufferPool.INSTANCE);
|
||||
case LZMA2:
|
||||
// Note: all LZMA/XZ compressors can be decompressed using this same InputStream
|
||||
return new XZInputStream(stream);
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.util.objects.dataStreams;
|
||||
|
||||
import com.github.luben.zstd.RecyclingBufferPool;
|
||||
import com.github.luben.zstd.ZstdOutputStream;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import net.jpountz.lz4.LZ4FrameOutputStream;
|
||||
@@ -47,7 +48,7 @@ public class DhDataOutputStream extends DataOutputStream
|
||||
case LZ4:
|
||||
return new LZ4FrameOutputStream(stream);
|
||||
case Z_STD:
|
||||
return new ZstdOutputStream(stream);
|
||||
return new ZstdOutputStream(stream, RecyclingBufferPool.INSTANCE);
|
||||
case LZMA2:
|
||||
// in James' testing preset 4 has the best balance between compression ratio and speed
|
||||
// 5 is slightly more compressed 0.128 vs 0.139, but is roughly 60% slower
|
||||
|
||||
Reference in New Issue
Block a user