[jbosscache-commits] JBoss Cache SVN: r5391 - core/trunk/src/test-perf/java/org/jboss/cache.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Mar 5 21:01:44 EST 2008


Author: mircea.markus
Date: 2008-03-05 21:01:44 -0500 (Wed, 05 Mar 2008)
New Revision: 5391

Modified:
   core/trunk/src/test-perf/java/org/jboss/cache/LockMapPerformanceTest.java
Log:
added some additional benchmarks

Modified: core/trunk/src/test-perf/java/org/jboss/cache/LockMapPerformanceTest.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/LockMapPerformanceTest.java	2008-03-06 00:45:19 UTC (rev 5390)
+++ core/trunk/src/test-perf/java/org/jboss/cache/LockMapPerformanceTest.java	2008-03-06 02:01:44 UTC (rev 5391)
@@ -208,5 +208,44 @@
          throw new RuntimeException("Did not expect " + val);
       }
    }
+
+   public void testIterationOverDirectAccess()
+   {
+      int size = 10000000;
+      List lm = new LinkedList();
+      Object oo = new Object();
+      for (int i = 0; i < size; i ++)
+      {
+         lm.add(oo);
+      }
+      long iteratingTimeStart = System.currentTimeMillis();
+      for (Object o : lm)
+      {
+          nothing(o);
+      }
+      System.out.println("Time needed for iterating: " + (System.currentTimeMillis() - iteratingTimeStart));
+      long seqAccessStart = System.currentTimeMillis();
+      for (int i =0; i < size; i++)
+      {
+         nothing(lm);
+      }
+      System.out.println("Time needed for seq access: " + (System.currentTimeMillis() - seqAccessStart));
+   }
+
+
+   void nothing(Object obj) {}
+
+   public void testCreationDurration()
+   {
+      int size = 100000;
+      Object[] pool = new Object[size];
+      long start = System.currentTimeMillis();
+      for (int i = 0; i < size; i++)
+      {
+         pool[i] = new ConcurrentHashSet();
+      }
+      System.out.println("Total durration: " + (System.currentTimeMillis() - start));
+      System.out.println(pool[0]);
+   }
 }
 




More information about the jbosscache-commits mailing list