You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/07/25 19:05:34 UTC

[GitHub] jihoonson closed pull request #5908: Use Blackhole objects to sink the method return in a benchmak loop (JMH)

jihoonson closed pull request #5908: Use Blackhole objects to sink the method return in a benchmak loop (JMH)
URL: https://github.com/apache/incubator-druid/pull/5908
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java
index 4abdee17878..5b2f0d85613 100644
--- a/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java
+++ b/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java
@@ -80,11 +80,9 @@ public void readContinuous(Blackhole bh)
   {
     ColumnarFloats columnarFloats = supplier.get();
     int count = columnarFloats.size();
-    float sum = 0;
     for (int i = 0; i < count; i++) {
-      sum += columnarFloats.get(i);
+      bh.consume(columnarFloats.get(i));
     }
-    bh.consume(sum);
     columnarFloats.close();
   }
 
@@ -93,11 +91,9 @@ public void readSkipping(Blackhole bh)
   {
     ColumnarFloats columnarFloats = supplier.get();
     int count = columnarFloats.size();
-    float sum = 0;
     for (int i = 0; i < count; i += rand.nextInt(2000)) {
-      sum += columnarFloats.get(i);
+      bh.consume(columnarFloats.get(i));
     }
-    bh.consume(sum);
     columnarFloats.close();
   }
 
diff --git a/benchmarks/src/main/java/io/druid/benchmark/LongCompressionBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/LongCompressionBenchmark.java
index 27fce45956e..1261f28b833 100644
--- a/benchmarks/src/main/java/io/druid/benchmark/LongCompressionBenchmark.java
+++ b/benchmarks/src/main/java/io/druid/benchmark/LongCompressionBenchmark.java
@@ -83,11 +83,9 @@ public void readContinuous(Blackhole bh)
   {
     ColumnarLongs columnarLongs = supplier.get();
     int count = columnarLongs.size();
-    long sum = 0;
     for (int i = 0; i < count; i++) {
-      sum += columnarLongs.get(i);
+      bh.consume(columnarLongs.get(i));
     }
-    bh.consume(sum);
     columnarLongs.close();
   }
 
@@ -96,11 +94,9 @@ public void readSkipping(Blackhole bh)
   {
     ColumnarLongs columnarLongs = supplier.get();
     int count = columnarLongs.size();
-    long sum = 0;
     for (int i = 0; i < count; i += rand.nextInt(2000)) {
-      sum += columnarLongs.get(i);
+      bh.consume(columnarLongs.get(i));
     }
-    bh.consume(sum);
     columnarLongs.close();
   }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org