[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo/collection ...

Elias Ross genman at noderunner.net
Fri Nov 10 00:19:04 EST 2006


  User: genman  
  Date: 06/11/10 00:19:04

  Modified:    tests-50/functional/org/jboss/cache/pojo/collection 
                        CollectionTest.java
  Log:
  Migrate perf tests to perf directory
  
  Revision  Changes    Path
  1.4       +1 -174    JBossCache/tests-50/functional/org/jboss/cache/pojo/collection/CollectionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CollectionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/collection/CollectionTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- CollectionTest.java	31 Oct 2006 11:07:16 -0000	1.3
  +++ CollectionTest.java	10 Nov 2006 05:19:04 -0000	1.4
  @@ -468,178 +468,5 @@
         }
      }
   
  -   /**
  -    * Commented it out now. We should move this to perf directory.
  -    *
  -    * @throws Exception
  -    */
  -   public void XtestListAddPerformance() throws Exception
  -   {
  -      Collection cache_List = new LinkedList();
  -      Collection jdkList = new LinkedList();
  -      addPerformance(cache_List, jdkList, "List");
  -   }
  -
  -   public void XtestSetAddPerformance() throws Exception
  -   {
  -      Collection cache_List = new HashSet();
  -      Collection jdkList = new HashSet();
  -      addPerformance(cache_List, jdkList, "Set");
  -   }
  -
  -   public void XtestMapAddPerformance() throws Exception
  -   {
  -      Map cacheList = new HashMap();
  -      Map jdkList = new HashMap();
  -      addPerformance(cacheList, jdkList, "Map");
  -   }
  -
  -   public void XtestListIterPerformance() throws Exception
  -   {
  -      Collection cacheList = new LinkedList();
  -      Collection jdkList = new LinkedList();
  -      iterPerformance(cacheList, jdkList, "List");
  -   }
  -
  -   public void XtestSetIterPerformance() throws Exception
  -   {
  -      Collection cacheList = new HashSet();
  -      Collection jdkList = new HashSet();
  -      iterPerformance(cacheList, jdkList, "Set");
  -   }
  -
  -   public void XtestMapIterPerformance() throws Exception
  -   {
  -      Map cacheList = new HashMap();
  -      Map jdkList = new HashMap();
  -      iterPerformance(cacheList, jdkList, "Map");
  -   }
  -
  -   public void addPerformance(Collection cacheList, Collection jdkList, String label) throws Exception
  -   {
  -      try
  -      {
  -         cache_.attach("/language/list", cacheList);
  -         cacheList = (Collection) cache_.find("/language/list");
  -
  -         long start = System.currentTimeMillis();
  -         collectionAdd(1000, jdkList);
  -         long jdkTime = System.currentTimeMillis() - start;
  -
  -         start = System.currentTimeMillis();
  -         collectionAdd(1000, cacheList);
  -         long cacheTime = System.currentTimeMillis() - start;
  -         //assertTrue(label + " 1000 add performance, jdk time=" + jdkTime +", cache time=" + cacheTime, goodEnough(cacheTime,jdkTime));
  -         log_.info(label + " 1000 add performance, jdk time=" + jdkTime + ", cache time=" + cacheTime);
  -      }
  -      catch (Exception e)
  -      {
  -         fail("testAddAll " + e.getMessage());
  -         throw e;
  -      }
  -   }
  -
  -   public void addPerformance(Map cacheList, Map jdkList, String label) throws Exception
  -   {
  -      try
  -      {
  -         cache_.attach("/language/list", cacheList);
  -         cacheList = (Map) cache_.find("/language/list");
  -
  -         long start = System.currentTimeMillis();
  -         collectionAdd(1000, jdkList);
  -         long jdkTime = System.currentTimeMillis() - start;
  -
  -         start = System.currentTimeMillis();
  -         collectionAdd(1000, cacheList);
  -         long cacheTime = System.currentTimeMillis() - start;
  -         //assertTrue(label + " 1000 add performance, jdk time=" + jdkTime +", cache time=" + cacheTime, goodEnough(cacheTime,jdkTime));
  -         log_.info(label + " 1000 add performance, jdk time=" + jdkTime + ", cache time=" + cacheTime);
  -      }
  -      catch (Exception e)
  -      {
  -         fail("testAddAll " + e.getMessage());
  -         throw e;
  -      }
  -   }
  -
  -   public void iterPerformance(Collection cacheList, Collection jdkList, String label) throws Exception
  -   {
  -      cache_.attach("/language/list", cacheList);
  -      cacheList = (Collection) cache_.find("/language/list");
  -
  -      collectionAdd(1000, jdkList);
  -      collectionAdd(1000, cacheList);
  -
  -      long start = System.currentTimeMillis();
  -      Iterator iter = jdkList.iterator();
  -      while (iter.hasNext())
  -         iter.next();
  -      long jdkTime = System.currentTimeMillis() - start;
  -
  -      start = System.currentTimeMillis();
  -      iter = cacheList.iterator();
  -      while (iter.hasNext())
  -         iter.next();
  -      long cacheTime = System.currentTimeMillis() - start;
  -      //assertTrue(label + " 1000 iter performance, jdk time=" + jdkTime +", cache time=" + cacheTime, goodEnough(cacheTime,jdkTime));
  -      log_.info(label + " 1000 iter performance, jdk time=" + jdkTime + ", cache time=" + cacheTime);
  -   }
  -
  -   public void iterPerformance(Map cacheList, Map jdkList, String label) throws Exception
  -   {
  -      cache_.attach("/language/list", cacheList);
  -      cacheList = (Map) cache_.find("/language/list");
  -
  -      collectionAdd(1000, jdkList);
  -      collectionAdd(1000, cacheList);
  -
  -      long start = System.currentTimeMillis();
  -      Iterator iter = jdkList.keySet().iterator();
  -      while (iter.hasNext())
  -         iter.next();
  -      long jdkTime = System.currentTimeMillis() - start;
  -
  -      start = System.currentTimeMillis();
  -      iter = cacheList.keySet().iterator();
  -      while (iter.hasNext())
  -         iter.next();
  -      long cacheTime = System.currentTimeMillis() - start;
  -
  -      //assertTrue(label + " 1000 iter performance, jdk time=" + jdkTime +", cache time=" + cacheTime, goodEnough(cacheTime,jdkTime));
  -      log_.info(label + " 1000 iter performance, jdk time=" + jdkTime + ", cache time=" + cacheTime);
  -      System.out.println(label + " 1000 iter performance, jdk time=" + jdkTime + ", cache time=" + cacheTime);
  -   }
  -
  -   public void collectionAdd(int count, Collection c) throws Exception
  -   {
  -      for (int looper = 0; looper < count; looper ++)
  -      {
  -         String value = Integer.toString(looper);
  -         c.add(value);
  -      }
  -   }
  -
  -   public void collectionAdd(int count, Map c) throws Exception
  -   {
  -      for (int looper = 0; looper < count; looper ++)
  -      {
  -         String value = Integer.toString(looper);
  -         c.put(value, value);
  -      }
  -   }
  -
  -   public boolean goodEnough(double cacheTime, double jdkTime)
  -   {
  -      if (jdkTime == 0)
  -         jdkTime = 1;
  -
  -      double percent = ((cacheTime - jdkTime) / jdkTime) * 100.0;
  -
  -      log_.info("percent =" + percent + " cache=" + cacheTime + " jdk =" + jdkTime);
  -      return percent < 100.0;
  -   }
  -
  -
   }
   
  
  
  



More information about the jboss-cvs-commits mailing list