jankotek/JDBM3 — Issue #4: hashMap vs treeMap: on add 4 times slower and 3 times bigger on file system. It seems isn't ok?
Author: terry239
Created: 2012-02-03 08:26:15+00:00
State: open

testHcreate 11245 ms.
testTcreate 2831 ms.

rw-r--r-- 1 terry LD\domain users 62M 3 фев 12:20 test.hash.dbm.d.0
-rw-r--r-- 1 terry LD\domain users 654K 3 фев 12:20 test.hash.dbm.i.0
-rw-r--r-- 1 terry LD\domain users 2B 3 фев 12:20 test.hash.dbm.t
-rw-r--r-- 1 terry LD\domain users 20M 3 фев 12:20 test.tree.dbm.d.0
-rw-r--r-- 1 terry LD\domain users 166K 3 фев 12:20 test.tree.dbm.i.0
-rw-r--r-- 1 terry LD\domain users 2B 3 фев 12:20 test.tree.dbm.t

int size = 300000;
int commitSize = 50000;
DB build = new DBMaker("test.hash.dbm").setMRUCacheSize(100).build();
Map hashMap = build.createHashMap("hashMap");
final Stopwatch start = Stopwatch.start();
for (int i = 0; i < size; i++) {
hashMap.put(i + "asdddfdgf" + i + "sddfdfsf" + i, "dsfgfg.dfcdfsgfg" + i);
if (i % commitSize == 0) {
build.commit();
}
}
build.commit();
build.close();
System.out.println("testHcreate " + start.newLoop() + " ms. ");

build = new DBMaker("test.tree.dbm").setMRUCacheSize(100).build();
Map treeMap = build.createTreeMap("treeMap");
for (int i = 0; i < size; i++) {
treeMap.put(i + "asdddfdgf" + i + "sddfdfsf" + i, "dsfgfg.dfcdfsgfg" + i);
if (i % commitSize == 0) {
build.commit();
}
}
build.commit();
build.close();
System.out.println("testTcreate " + start.newLoop() + " ms. " );