This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch feature/UIMA-5823-Add-basic-benchmarking-module
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git


The following commit(s) were added to 
refs/heads/feature/UIMA-5823-Add-basic-benchmarking-module by this push:
     new 4fc38ea  [UIMA-5823] Add basic benchmarking module
4fc38ea is described below

commit 4fc38ea592e42f9293dfc597bd1a22421f69216f
Author: Richard Eckart de Castilho <[email protected]>
AuthorDate: Sun Jul 15 19:11:16 2018 +0200

    [UIMA-5823] Add basic benchmarking module
    
    - Added a benchmark for select/indexCovering
---
 .../uima/fit/benchmark/JCasUtilBenchmark.java      | 27 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git 
a/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/JCasUtilBenchmark.java
 
b/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/JCasUtilBenchmark.java
index d7db0d8..5749aa8 100644
--- 
a/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/JCasUtilBenchmark.java
+++ 
b/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/JCasUtilBenchmark.java
@@ -20,9 +20,11 @@ package org.apache.uima.fit.benchmark;
 
 import static 
org.apache.uima.fit.benchmark.CasInitializationUtils.initRandomCas;
 import static org.apache.uima.fit.util.JCasUtil.indexCovered;
+import static org.apache.uima.fit.util.JCasUtil.indexCovering;
 import static org.apache.uima.fit.util.JCasUtil.select;
 import static org.apache.uima.fit.util.JCasUtil.selectAll;
 import static org.apache.uima.fit.util.JCasUtil.selectCovered;
+import static org.apache.uima.fit.util.JCasUtil.selectCovering;
 
 import org.apache.uima.fit.factory.JCasFactory;
 import org.apache.uima.fit.type.Sentence;
@@ -89,10 +91,10 @@ public class JCasUtilBenchmark {
   @Test
   public void benchmarkSelectCovered() {
     Benchmark template = new Benchmark("TEMPLATE")
-        .initialize(n -> initRandomCas(jcas.getCas(), n))
-        .magnitude(10)
-        .magnitudeIncrement(count -> count * 10)
-        .incrementTimes(4);
+      .initialize(n -> initRandomCas(jcas.getCas(), n))
+      .magnitude(10)
+      .magnitudeIncrement(count -> count * 10)
+      .incrementTimes(4);
     
     new Benchmark("JCas selectCovered", template)
       .measure(() -> select(jcas, Sentence.class).forEach(s -> 
selectCovered(Token.class, s)))
@@ -102,4 +104,21 @@ public class JCasUtilBenchmark {
       .measure(() -> indexCovered(jcas, Sentence.class, Token.class))
       .run();
   }
+  
+  @Test
+  public void benchmarkSelectCovering() {
+    Benchmark template = new Benchmark("TEMPLATE")
+      .initialize(n -> initRandomCas(jcas.getCas(), n))
+      .magnitude(10)
+      .magnitudeIncrement(count -> count * 10)
+      .incrementTimes(3);
+    
+    new Benchmark("JCas selectCovering", template)
+      .measure(() -> select(jcas, Token.class).forEach(s -> 
selectCovering(Sentence.class, s)))
+      .run();
+
+    new Benchmark("JCas indexCovering", template)
+      .measure(() -> indexCovering(jcas, Token.class, Sentence.class))
+      .run();
+  }
 }

Reply via email to