diff --git a/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/FloatCompressionBenchmark.java index 35886ceac8f..9d519989e96 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 fe33fc0fb77..9445eb1c45d 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(); }