Fixes issue 9. The cause of slow-performance in streaming mode was default buffer size 8MB. When I changed it from 8MB to 8KB, the decompression (stream) performance was improved.

This commit is contained in:
Taro L. Saito 2011-04-03 17:54:52 +09:00
parent b694432815
commit e77174e041

View File

@ -84,7 +84,7 @@ public class SnappyInputStream extends InputStream
protected void readFully(byte[] fragment, int fragmentLength) throws IOException {
// read the entire input data to the buffer
compressed = new byte[Math.max(SnappyOutputStream.DEFAULT_BLOCK_SIZE, fragmentLength)];
compressed = new byte[Math.max(8 * 1024, fragmentLength)]; // 8K
System.arraycopy(fragment, 0, compressed, 0, fragmentLength);
int cursor = fragmentLength;
for (int readBytes = 0; (readBytes = in.read(compressed, cursor, compressed.length - cursor)) != -1;) {