Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Performance tuning. Looks incredibly fast, and all tests pass.

  • Loading branch information...
commit a97cf3c1f1469375cf4cb9832d517de90700e06f 1 parent d340565
Shevek authored
View
6 README
@@ -6,9 +6,9 @@ This package is an implementation of that obvious solution, for which
I can only apologise to the world.
It turns out, however, that the compression performance on a single
-2.4GHz laptop CPU is in excess of 45Mb/sec, and decompression runs
-at 300Mb/sec with all checking enabled, which seems to be more than
-adequate.
+2.4GHz laptop CPU is in excess of 500Mb/sec, and decompression runs
+at 815Mb/sec, which seems to be more than adequate. Run
+PerformanceTest on an appropriate file to reproduce these figures.
Notes on BlockCompressionStream, as of Hadoop 0.21.x:
View
14 jcpp/src/lzo1x_d.ch
@@ -129,9 +129,10 @@ GOTO_0: { // Java-goto
{ state = match_next; break GOTO_0; }
assert(t > 0); NEED_OP(t, break GOTO_0); NEED_IP(t+1, break GOTO_0);
//Java do *op++ = *ip++ while (--t > 0);
- System.arraycopy(in, in_ptr, out, out_ptr, t);
- in_ptr += t;
- out_ptr += t;
+ // System.arraycopy(in, in_ptr, out, out_ptr, t);
+ // in_ptr += t;
+ // out_ptr += t;
+ do out[out_ptr++] = in[in_ptr++]; while (--t > 0);
//Java goto first_literal_run;
{ state = first_literal_run; break GOTO_0; }
}
@@ -214,9 +215,10 @@ GOTO_BEGIN(GOTO_PRE)
//Java *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
//Java do *op++ = *ip++; while (--t > 0);
t += 3;
- System.arraycopy(in, in_ptr, out, out_ptr, t);
- in_ptr += t;
- out_ptr += t;
+ // System.arraycopy(in, in_ptr, out, out_ptr, t);
+ // in_ptr += t;
+ // out_ptr += t;
+ do out[out_ptr++] = in[in_ptr++]; while (--t > 0);
}
#endif
View
1  src/org/anarres/lzo/LzoInputStream.java
@@ -27,7 +27,6 @@
private byte[] outputBuffer = EMPTY_BYTE_ARRAY;
private int outputBufferPos;
private final lzo_uintp outputBufferLen = new lzo_uintp(); // Also, end, since we base outputBuffer at 0.
- private boolean eof = false;
public LzoInputStream(InputStream in, LzoDecompressor decompressor) {
this.in = in;
View
9 test/org/anarres/lzo/PerformanceTest.java
@@ -33,17 +33,20 @@ public void testBlockCompress() throws Exception {
LOG.info("Original data is " + data.length + " bytes.");
byte[] compressed = new byte[data.length];
- for (int i = 0; i < 4; i++) {
+ LzoCompressor compressor = new LzoCompressor1x_1();
+ LzoDecompressor decompressor = new LzoDecompressor1x();
+
+ for (int i = 0; i < 8; i++) {
lzo_uintp compressed_length = new lzo_uintp(compressed.length);
LOG.info("Starting.");
long start = System.currentTimeMillis();
- LzoCompressor1x_1.compress(data, 0, data.length , compressed, 0, compressed_length, new int[1<<14]);
+ compressor.compress(data, 0, data.length , compressed, 0, compressed_length);
long end = System.currentTimeMillis();
LOG.info("Compression took " + ((end - start) / 1000d) + " ms");
lzo_uintp uncompressed_length = new lzo_uintp(data.length);
start = System.currentTimeMillis();
- LzoDecompressor1x.decompress(compressed, 0, compressed_length.value, data, 0, uncompressed_length, null);
+ decompressor.decompress(compressed, 0, compressed_length.value, data, 0, uncompressed_length);
end = System.currentTimeMillis();
LOG.info("Uncompression took " + ((end - start) / 1000d) + " ms");
}

0 comments on commit a97cf3c

Please sign in to comment.
Something went wrong with that request. Please try again.