From 652b47f943902fb3decfd60a5183e91000f4df18 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Fri, 19 Oct 2012 19:31:36 +0000 Subject: [PATCH] add little performance test for split values in the list index, disabled atm git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1400242 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/kahadb/index/ListIndexTest.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java b/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java index d5aced219c..8756c38141 100644 --- a/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java +++ b/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java @@ -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 IndexTestSupport { 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 IndexTestSupport { } } + 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 test = new ListIndex(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