no Jira - allow repetitions for performance testing (manual)
@@ -46,6 +46,8 @@ import junit.framework.TestCase;
*/
public class GrowingTheCasTestNoJcasCache extends TestCase {
+ private final static int REPETITIONS = 1;
+
private AnalysisEngine ae = null;
private JCas smallHeapCas = null;
@@ -116,7 +118,7 @@ public class GrowingTheCasTestNoJcasCache extends TestCase {
e.printStackTrace();
assertTrue(false);
}
- StringBuffer buf = new StringBuffer(text.length() * 10);
+ StringBuilder buf = new StringBuilder(text.length() * 10);
for (int i = 0; i < 10; i++) {
buf.append(text);
}
@@ -131,6 +133,12 @@ public class GrowingTheCasTestNoJcasCache extends TestCase {
jcas.setDocumentText(text);
int numberOfSentences = 0;
int numberOfTokens = 0;
+ for (int i = 0; i < REPETITIONS; i++) {
+ jcas.reset();
+ this.smallHeapCas.reset();
+ jcas.setDocumentText(text);
+ numberOfSentences = 0;
+ numberOfTokens = 0;
try {
// long time = System.currentTimeMillis();
this.ae.process(jcas);
@@ -157,10 +165,11 @@ public class GrowingTheCasTestNoJcasCache extends TestCase {
} catch (AnalysisEngineProcessException e) {
e.printStackTrace();
assertTrue(false);
- } finally {
- smallHeapCas = null; // some junit runners hold onto instances of test classes after the test finishes
}
}
+ smallHeapCas = null; // some junit runners hold onto instances of test classes after the test finishes
+
+ }
public static void main(String[] args) {
junit.textui.TestRunner.run(GrowingTheCasTestNoJcasCache.class);
