提交 5ebbd9a8 authored 作者: Thomas Mueller's avatar Thomas Mueller

Slightly better compression ratio for page store data.

上级 c9eb64bf
...@@ -63,8 +63,7 @@ public class CompressLZF implements Compressor { ...@@ -63,8 +63,7 @@ public class CompressLZF implements Compressor {
} }
private int hash(int h) { private int hash(int h) {
// or 57321 return ((h * 2777) >> 9) & (HASH_SIZE - 1);
return ((h * 184117) >> 9) & (HASH_SIZE - 1);
} }
public int compress(byte[] in, int inLen, byte[] out, int outPos) { public int compress(byte[] in, int inLen, byte[] out, int outPos) {
......
...@@ -36,10 +36,10 @@ public class TestCompress extends TestBase { ...@@ -36,10 +36,10 @@ public class TestCompress extends TestBase {
} }
public void test() throws Exception { public void test() throws Exception {
testMultiThreaded();
if (testPerformance) { if (testPerformance) {
testDatabase(); testDatabase();
} }
testMultiThreaded();
if (config.big) { if (config.big) {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
test(i); test(i);
...@@ -135,14 +135,15 @@ public class TestCompress extends TestBase { ...@@ -135,14 +135,15 @@ public class TestCompress extends TestBase {
compress.compress(buff, pageSize, test, 0); compress.compress(buff, pageSize, test, 0);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 1000; i++) {
InputStream in = FileSystem.getInstance("memFS:").openFileInputStream("memFS:compress.h2.db"); InputStream in = FileSystem.getInstance("memFS:").openFileInputStream("memFS:compress.h2.db");
int total = 0;
while (true) { while (true) {
int len = in.read(buff); int len = in.read(buff);
if (len < 0) { if (len < 0) {
break; break;
} }
compress.compress(buff, pageSize, test, 0); total += compress.compress(buff, pageSize, test, 0);
} }
in.close(); in.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论