| 1 16 package scriptella.util; 17 18 import scriptella.AbstractTestCase; 19 20 26 public class ColumnsMapPerfTest extends AbstractTestCase { 27 private ColumnsMap cm; 28 private static final int SEARCH_LOOP_COUNT = 300000; 29 private static final String [] colNames=new String [400]; 30 private static final String [] colIndeces=new String [colNames.length]; 31 static { 32 for (int i=0;i<colNames.length;i++) { 33 colNames[i]="col"+i; 34 colIndeces[i]=String.valueOf(i); 35 } 36 } 37 38 protected void setUp() throws Exception { 39 super.setUp(); 40 cm=new ColumnsMap(); 41 for (int i=1;i<200;i++) { 42 cm.registerColumn(colNames[i].toUpperCase(),i); 43 } 44 } 45 46 51 public void testNamedSearch() { 52 for (int i=1;i<SEARCH_LOOP_COUNT;i++) { 53 cm.find(colNames[i%250]); } 55 } 56 57 62 public void testIndexedSearch() { 63 for (int i=1;i<SEARCH_LOOP_COUNT;i++) { 64 cm.find(colIndeces[i%250]); } 66 } 67 68 69 74 public void testFill() { 75 for (int k=1;k<700;k++) { 76 for (int i=1;i<colNames.length;i++) { 77 cm.registerColumn(colNames[i],i); 78 } 79 } 80 } 81 } 82 | Popular Tags |