You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ke...@apache.org on 2016/08/06 02:52:33 UTC

[15/51] [abbrv] incubator-beam git commit: Port microbenchmarks to new vocabulary

Port microbenchmarks to new vocabulary


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/e07c3397
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/e07c3397
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/e07c3397

Branch: refs/heads/python-sdk
Commit: e07c3397d268f50cc879362227a6887cc52f4a3b
Parents: 3236eec
Author: Kenneth Knowles <kl...@google.com>
Authored: Fri Jul 22 14:29:51 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Wed Aug 3 18:25:53 2016 -0700

----------------------------------------------------------------------
 .../transforms/DoFnReflectorBenchmark.java      | 27 ++++++++++----------
 1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e07c3397/sdks/java/microbenchmarks/src/main/java/org/apache/beam/sdk/microbenchmarks/transforms/DoFnReflectorBenchmark.java
----------------------------------------------------------------------
diff --git a/sdks/java/microbenchmarks/src/main/java/org/apache/beam/sdk/microbenchmarks/transforms/DoFnReflectorBenchmark.java b/sdks/java/microbenchmarks/src/main/java/org/apache/beam/sdk/microbenchmarks/transforms/DoFnReflectorBenchmark.java
index fd75e95..233b8be 100644
--- a/sdks/java/microbenchmarks/src/main/java/org/apache/beam/sdk/microbenchmarks/transforms/DoFnReflectorBenchmark.java
+++ b/sdks/java/microbenchmarks/src/main/java/org/apache/beam/sdk/microbenchmarks/transforms/DoFnReflectorBenchmark.java
@@ -53,9 +53,10 @@ public class DoFnReflectorBenchmark {
   private OldDoFn<String, String> oldDoFn = new UpperCaseOldDoFn();
   private DoFn<String, String> doFn = new UpperCaseDoFn();
 
-  private StubDoFnProcessContext stubDoFnContext = new StubDoFnProcessContext(oldDoFn, ELEMENT);
-  private StubDoFnWithContextProcessContext stubDoFnWithContextContext =
-      new StubDoFnWithContextProcessContext(doFn, ELEMENT);
+  private StubOldDoFnProcessContext stubOldDoFnContext = new StubOldDoFnProcessContext(oldDoFn,
+      ELEMENT);
+  private StubDoFnProcessContext stubDoFnContext =
+      new StubDoFnProcessContext(doFn, ELEMENT);
   private ExtraContextFactory<String, String> extraContextFactory =
       new ExtraContextFactory<String, String>() {
 
@@ -83,21 +84,21 @@ public class DoFnReflectorBenchmark {
   }
 
   @Benchmark
-  public String invokeDoFn() throws Exception {
-    oldDoFn.processElement(stubDoFnContext);
+  public String invokeOldDoFn() throws Exception {
+    oldDoFn.processElement(stubOldDoFnContext);
     return stubDoFnContext.output;
   }
 
   @Benchmark
   public String invokeDoFnWithContextViaAdaptor() throws Exception {
-    adaptedDoFnWithContext.processElement(stubDoFnContext);
-    return stubDoFnContext.output;
+    adaptedDoFnWithContext.processElement(stubOldDoFnContext);
+    return stubOldDoFnContext.output;
   }
 
   @Benchmark
   public String invokeDoFnWithContext() throws Exception {
-    invoker.invokeProcessElement(stubDoFnWithContextContext, extraContextFactory);
-    return stubDoFnWithContextContext.output;
+    invoker.invokeProcessElement(stubDoFnContext, extraContextFactory);
+    return stubDoFnContext.output;
   }
 
   private static class UpperCaseOldDoFn extends OldDoFn<String, String> {
@@ -116,12 +117,12 @@ public class DoFnReflectorBenchmark {
     }
   }
 
-  private static class StubDoFnProcessContext extends OldDoFn<String, String>.ProcessContext {
+  private static class StubOldDoFnProcessContext extends OldDoFn<String, String>.ProcessContext {
 
     private final String element;
     private String output;
 
-    public StubDoFnProcessContext(OldDoFn<String, String> fn, String element) {
+    public StubOldDoFnProcessContext(OldDoFn<String, String> fn, String element) {
       fn.super();
       this.element = element;
     }
@@ -186,12 +187,12 @@ public class DoFnReflectorBenchmark {
     }
   }
 
-  private static class StubDoFnWithContextProcessContext
+  private static class StubDoFnProcessContext
       extends DoFn<String, String>.ProcessContext {
     private final String element;
     private  String output;
 
-    public StubDoFnWithContextProcessContext(DoFn<String, String> fn, String element) {
+    public StubDoFnProcessContext(DoFn<String, String> fn, String element) {
       fn.super();
       this.element = element;
     }