for(int j=0;j<3;j++){
boolean useSmallValues = (j==0);
boolean valueOutsideOfNodes = (j==2);
DB db = DBMaker
.newFileDB(new File("/mnt/big/adsasd"))
.deleteFilesAfterClose()
.closeOnJvmShutdown()
.transactionDisable()
.cacheSize(10) //use small cache size, to simulate much larger store with relatively small cache.
.make();
Map<Long,String> map =
(valueOutsideOfNodes?
(db.createTreeMap("test").valuesOutsideNodesEnable()):
db.createTreeMap("test"))
.nodeSize(nodeSize)
.make();
long startTime = System.currentTimeMillis();
for(int i=0;i<1e6;i++){
long key = r.nextLong();
String value = useSmallValues?
//small value
"abc"+key:
//large value
"qwdkqwdoqpwfwe-09fewkljklcejewfcklajewjkleawckjlaweklcwelkcwecklwecjwekecklwecklaa"
+"kvlskldvklsdklcklsdvkdflvvvvvvvvvvvvvvvvvvvvvvvsl;kzlkvlksdlkvklsdklvkldsklk"
+key;
map.put(key, value);
}
System.out.print(" ");
System.out.print((System.currentTimeMillis()-startTime)/1000+" s");
System.out.print(" |");
db.close();
}
System.out.println("");
}
}