} else {
index.writeIndex(DataGenerator.randomIterator(lookupHits, size, hitrate, minStrLen, maxStrLen, minChar, maxChar));
}
} else {
// populate the lookup-hits table
DiskIndex diskIndexTmp = new DiskIndex(path, new DefaultByteRangeComparator(), compress, mmap);
Iterator<Entry<byte[], byte[]>> itTmp = diskIndexTmp.rangeLookup(null, null, true);
while(itTmp.hasNext()) {
if(generator.nextInt() % hitrate == 0)
lookupHits.add(itTmp.next().getKey());
}
diskIndexTmp.destroy();
}
// do a warm-up phase to trick the JVM
int warmups = 5;
while(warmups-- > 0) {
int readEntries = 10000;
// read the disk index
DiskIndex diskIndex = new DiskIndex(path, new DefaultByteRangeComparator(), compress, mmap);
Iterator<Entry<byte[], byte[]>> it = diskIndex.rangeLookup(null, null, true);
while(it.hasNext() && readEntries-- > 0) it.next();
diskIndex.destroy();
}
// clear caches...
Runtime.getRuntime().exec("/bin/sync");
Runtime.getRuntime().exec("/bin/echo 3 > /proc/sys/vm/drop_caches");
// run garbage collection to remove any existing mmap:ed pages
Runtime.getRuntime().gc();
// read the disk index
DiskIndex diskIndex = new DiskIndex(path, new DefaultByteRangeComparator(), compress, mmap);
Iterator<Entry<byte[], byte[]>> it = diskIndex.rangeLookup(null, null, true);
/* iterate over all data in the disk index to measure the prefix lookup throughput */
long iterStart = System.currentTimeMillis();
while(it.hasNext()) it.next();