} else {
for (int i = 0; i < numRows; i++) {
int row = rand.nextInt(1000000000);
for (int j = 0; j < numCols; j++) {
int col = rand.nextInt(1000000);
Key key = nk(row, col);
Value val = new Value("test".getBytes(Constants.UTF8));
tm.put(key, val);
}
}
}
long tpe = System.currentTimeMillis();
// Iteration
Iterator<Entry<Key,Value>> iter;
if (nm != null) {
iter = nm.iterator();
} else {
iter = tm.entrySet().iterator();
}
long tis = System.currentTimeMillis();
while (iter.hasNext()) {
iter.next();
}
long tie = System.currentTimeMillis();
rand = new Random(19);
int rowsToLookup[] = new int[numLookups];
int colsToLookup[] = new int[numLookups];
for (int i = 0; i < Math.min(numLookups, numRows); i++) {
int row = rand.nextInt(1000000000);
int col = -1;
for (int j = 0; j < numCols; j++) {
col = rand.nextInt(1000000);
}
rowsToLookup[i] = row;
colsToLookup[i] = col;
}
// get
long tgs = System.currentTimeMillis();
if (nm != null) {
for (int i = 0; i < numLookups; i++) {
Key key = nk(rowsToLookup[i], colsToLookup[i]);
if (nm.get(key) == null) {
throw new RuntimeException("Did not find " + rowsToLookup[i] + " " + colsToLookup[i] + " " + i);
}
}
} else {
for (int i = 0; i < numLookups; i++) {
Key key = nk(rowsToLookup[i], colsToLookup[i]);
if (tm.get(key) == null) {
throw new RuntimeException("Did not find " + rowsToLookup[i] + " " + colsToLookup[i] + " " + i);
}
}
}