static public void doRandomIndexOfTest(final String label,final AbstractBTree btree,final byte[][] keys,final byte[][] vals){
  final int nentries=keys.length;
  if (log.isInfoEnabled())   log.info("\ncondition: " + label + ", nentries="+ nentries);
  final int[] order=getRandomOrder(nentries);
  final long begin=System.currentTimeMillis();
  final boolean randomOrder=true;
  for (int i=0; i < nentries; i++) {
    final int entryIndex=randomOrder ? order[i] : i;
    final byte[] key=keys[entryIndex];
    assertEquals("indexOf",entryIndex,btree.indexOf(key));
    final byte[] expectedVal=vals[entryIndex];
    assertEquals("keyAt",key,btree.keyAt(entryIndex));
    assertEquals("valueAt",expectedVal,btree.valueAt(entryIndex));
  }
  if (log.isInfoEnabled()) {
    final long elapsed=System.currentTimeMillis() - begin;
    log.info(label + " : tested " + nentries+ " keys in "+ elapsed+ "ms");
  }
}

static public void doRandomIndexOfTest ( final String label , final AbstractBTree btree , final byte [ ] [ ] keys , final byte [ ] [ ] vals ) { final int nentries = keys . length ; if ( log . isInfoEnabled ( ) ) log . info ( "\ncondition: " + label + ", nentries=" + nentries ) ; final int [ ] order = getRandomOrder ( nentries ) ; final long begin = System . currentTimeMillis ( ) ; final boolean randomOrder = true ; for ( int i = 0 ; i < nentries ; i ++ ) { final int entryIndex = randomOrder ? order [ i ] : i ; final byte [ ] key = keys [ entryIndex ] ; assertEquals ( "indexOf" , entryIndex , btree . indexOf ( key ) ) ; final byte [ ] expectedVal = vals [ entryIndex ] ; assertEquals ( "keyAt" , key , btree . keyAt ( entryIndex ) ) ; assertEquals ( "valueAt" , expectedVal , btree . valueAt ( entryIndex ) ) ; } if ( log . isInfoEnabled ( ) ) { final long elapsed = System . currentTimeMillis ( ) - begin ; log . info ( label + " : tested " + nentries + " keys in " + elapsed + "ms" ) ; } }
tests the performance of random lookups of keys and values by entry index . this vets the separator keys and childref / childaddr arrays , which are used to lookup the entry index for a key , and also vets the childentrycount [ ] array , since that is responsible for lookup by entry index .
