activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1400242 - /activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java
Date Fri, 19 Oct 2012 19:31:37 GMT
Author: gtully
Date: Fri Oct 19 19:31:36 2012
New Revision: 1400242

URL: http://svn.apache.org/viewvc?rev=1400242&view=rev
Log:
add little performance test for split values in the list index, disabled atm

Modified:
    activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java

Modified: activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java?rev=1400242&r1=1400241&r2=1400242&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java (original)
+++ activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java Fri Oct
19 19:31:36 2012
@@ -32,6 +32,7 @@ import java.util.Random;
 
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.util.LongMarshaller;
+import org.apache.kahadb.util.Sequence;
 import org.apache.kahadb.util.SequenceSet;
 import org.apache.kahadb.util.StringMarshaller;
 import org.apache.kahadb.util.VariableMarshaller;
@@ -428,7 +429,7 @@ public class ListIndexTest extends Index
         return "key:" + nf.format(i);
     }
 
-    public void testListIndexConsistancyOverTime() throws Exception {
+    public void testListIndexConsistencyOverTime() throws Exception {
 
         final int NUM_ITERATIONS = 100;
 
@@ -562,6 +563,42 @@ public class ListIndexTest extends Index
         }
     }
 
+    public void x_testSplitPerformance() throws Exception {
+
+        final int NUM_ITERATIONS = 200;
+        final int RANGE = 200000;
+
+        pf = new PageFile(directory, getClass().getName());
+        pf.setPageSize(4*1024);
+        pf.load();
+        tx = pf.tx();
+        long id = tx.allocate().getPageId();
+
+        ListIndex<String, SequenceSet> test = new ListIndex<String, SequenceSet>(pf,
id);
+        test.setKeyMarshaller(StringMarshaller.INSTANCE);
+        test.setValueMarshaller(SequenceSet.Marshaller.INSTANCE);
+        test.load(tx);
+        tx.commit();
+
+        for (int i = 0; i < NUM_ITERATIONS; ++i) {
+            Sequence sequence = new Sequence(0);
+            sequence.setLast(RANGE);
+            SequenceSet sequenceSet  = new SequenceSet();
+            sequenceSet.add(sequence);
+            test.add(tx, String.valueOf(i), sequenceSet);
+        }
+
+        long start = System.currentTimeMillis();
+
+        // overflow the value in the last sequence
+        SequenceSet sequenceSet = test.get(tx, String.valueOf(NUM_ITERATIONS - 10));
+        for (int i=0; i<RANGE; i+=2) {
+            sequenceSet.remove(i);
+            test.put(tx, String.valueOf(NUM_ITERATIONS -1), sequenceSet);
+        }
+        LOG.info("duration: " + (System.currentTimeMillis() - start));
+    }
+
     public void testListLargeDataAddAndNonSequentialRemove() throws Exception {
 
         final int NUM_ITERATIONS = 100;



Mime
View raw message