You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by ji...@apache.org on 2018/07/25 19:05:38 UTC
[incubator-druid] branch master updated: Use Blackhole objects to
sink the method return in a benchmak loop (JMH) (#5908)
This is an automated email from the ASF dual-hosted git repository.
jihoonson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new e4ef753a Use Blackhole objects to sink the method return in a benchmak loop (JMH) (#5908)
e4ef753a is described below
commit e4ef753a6041d90289c33d34eba819659315ce23
Author: Diego Costa <di...@gmail.com>
AuthorDate: Wed Jul 25 21:05:32 2018 +0200
Use Blackhole objects to sink the method return in a benchmak loop (JMH) (#5908)
* Remove the unsafe loop from the benchmark
* Removing unused variables
---
.../main/java/io/druid/benchmark/FloatCompressionBenchmark.java | 8 ++------
.../main/java/io/druid/benchmark/LongCompressionBenchmark.java | 8 ++------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java
index 35886ce..9d51998 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 class FloatCompressionBenchmark
{
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 class FloatCompressionBenchmark
{
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 fe33fc0..9445eb1 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 class LongCompressionBenchmark
{
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 class LongCompressionBenchmark
{
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();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org