You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2018/07/15 17:24:24 UTC

[uima-uimafit] 03/03: [UIMA-5823] Add basic benchmarking module

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-v3
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 9e1cf4d0361885acb45dc5895f0dcfbd6e0b489d
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Sun Jul 15 19:24:17 2018 +0200

    [UIMA-5823] Add basic benchmarking module
    
    - Added a benchmark for select/indexCovering
---
 .../org/apache/uima/fit/benchmark/CasUtilBenchmark.java | 17 +++++++++++++----
 .../apache/uima/fit/benchmark/JCasUtilBenchmark.java    | 12 +++++++++---
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/CasUtilBenchmark.java b/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/CasUtilBenchmark.java
index 569b884..414c364 100644
--- a/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/CasUtilBenchmark.java
+++ b/uimafit-benchmark/src/test/java/org/apache/uima/fit/benchmark/CasUtilBenchmark.java
@@ -147,16 +147,25 @@ public class CasUtilBenchmark {
       .magnitudeIncrement(count -> count * 10)
       .incrementTimes(3);
     
-    new Benchmark("JCas selectCovering", template)
+    new Benchmark("CAS selectCovering", template)
       .measure(() -> {
         Type sentenceType = getType(cas, TYPE_NAME_SENTENCE);
         Type tokenType = getType(cas, TYPE_NAME_TOKEN);
-        select(cas, tokenType).forEach(s -> selectCovering(sentenceType, s));
+        select(cas, tokenType).forEach(t -> selectCovering(sentenceType, t));
       })
       .run();
 
-    new Benchmark("JCas indexCovering", template)
-      .measure(() -> indexCovering(cas, getType(cas, TYPE_NAME_TOKEN), getType(cas, TYPE_NAME_SENTENCE)))
+    new Benchmark("CAS selectCovering v3", template)
+      .measure(() -> {
+        Type sentenceType = getType(cas, TYPE_NAME_SENTENCE);
+        Type tokenType = getType(cas, TYPE_NAME_TOKEN);
+        cas.select(tokenType).forEach(t -> cas.select(sentenceType).covering((AnnotationFS) t).forEach(s -> {}));
+      })
+      .run();
+
+    new Benchmark("CAS indexCovering", template)
+      .measure(() -> indexCovering(cas, getType(cas, TYPE_NAME_TOKEN), getType(cas, TYPE_NAME_SENTENCE))
+          .forEach((t, l) -> l.forEach(s -> {})))
       .run();
   }
 }
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 49b907c..befc574 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
@@ -123,7 +123,7 @@ public class JCasUtilBenchmark {
     .run();
 
     new Benchmark("JCas indexCovered", template)
-      .measure(() -> indexCovered(jcas, Sentence.class, Token.class))
+      .measure(() -> indexCovered(jcas, Sentence.class, Token.class).forEach((s, l) -> l.forEach(t -> {})))
       .run();
   }
   
@@ -136,11 +136,17 @@ public class JCasUtilBenchmark {
       .incrementTimes(3);
     
     new Benchmark("JCas selectCovering", template)
-      .measure(() -> select(jcas, Token.class).forEach(s -> selectCovering(Sentence.class, s)))
+      .measure(() -> select(jcas, Token.class).forEach(t -> selectCovering(Sentence.class, t)))
       .run();
 
+    new Benchmark("JCas selectCovering v3", template)
+      .measure(() -> {
+          jcas.select(Token.class).forEach(t -> jcas.select(Sentence.class).covering(t).forEach(s -> {}));
+      })
+    .run();
+    
     new Benchmark("JCas indexCovering", template)
-      .measure(() -> indexCovering(jcas, Token.class, Sentence.class))
+      .measure(() -> indexCovering(jcas, Token.class, Sentence.class).forEach((t, l) -> l.forEach(s -> {})))
       .run();
   }
 }