You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by fs...@apache.org on 2019/06/28 19:19:38 UTC
[arrow] branch master updated: ARROW-5780: [C++] Add benchmark for
Decimal operations
This is an automated email from the ASF dual-hosted git repository.
fsaintjacques pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new e2cdfd0 ARROW-5780: [C++] Add benchmark for Decimal operations
e2cdfd0 is described below
commit e2cdfd0ebcf991e4038455363b9f4c8a74a5721e
Author: Micah Kornfield <em...@gmail.com>
AuthorDate: Fri Jun 28 15:19:26 2019 -0400
ARROW-5780: [C++] Add benchmark for Decimal operations
Author: Micah Kornfield <em...@gmail.com>
Closes #4740 from emkornfield/bench2 and squashes the following commits:
8ff544ea5 <Micah Kornfield> use static call
5cac5b69f <Micah Kornfield> ARROW-5780: Add benchmark for Decimal operations
---
cpp/src/arrow/util/decimal-benchmark.cc | 50 +++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/cpp/src/arrow/util/decimal-benchmark.cc b/cpp/src/arrow/util/decimal-benchmark.cc
index bd7c056..41cb861 100644
--- a/cpp/src/arrow/util/decimal-benchmark.cc
+++ b/cpp/src/arrow/util/decimal-benchmark.cc
@@ -44,7 +44,57 @@ static void FromString(benchmark::State& state) { // NOLINT non-const reference
state.SetItemsProcessed(state.iterations() * values.size());
}
+static void BinaryCompareOp(benchmark::State& state) { // NOLINT non-const reference
+ BasicDecimal128 d1(546, 123), d2(123, 456);
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(d1 == d2);
+ benchmark::DoNotOptimize(d1 <= d2);
+ benchmark::DoNotOptimize(d1 >= d2);
+ benchmark::DoNotOptimize(d1 >= d1);
+ }
+}
+
+static void BinaryMathOp(benchmark::State& state) { // NOLINT non-const reference
+ BasicDecimal128 d1(546, 123), d2(123, 456), d3(0, 10);
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(d1 - d2);
+ benchmark::DoNotOptimize(d1 + d2);
+ benchmark::DoNotOptimize(d1 * d2);
+ benchmark::DoNotOptimize(d1 / d2);
+ benchmark::DoNotOptimize(d1 % d3);
+ }
+}
+
+static void UnaryOp(benchmark::State& state) { // NOLINT non-const reference
+ BasicDecimal128 d1(-546, 123), d2(-123, 456);
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(d1.Abs());
+ benchmark::DoNotOptimize(d2.Negate());
+ }
+}
+
+static void Constants(benchmark::State& state) { // NOLINT non-const reference
+ BasicDecimal128 d1(-546, 123), d2(-123, 456);
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(BasicDecimal128::GetMaxValue() - d1);
+ benchmark::DoNotOptimize(BasicDecimal128::GetScaleMultiplier(3) + d2);
+ }
+}
+
+static void BinaryBitOp(benchmark::State& state) { // NOLINT non-const reference
+ BasicDecimal128 d1(546, 123), d2(123, 456);
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(d1 |= d2);
+ benchmark::DoNotOptimize(d1 &= d2);
+ }
+}
+
BENCHMARK(FromString);
+BENCHMARK(BinaryMathOp);
+BENCHMARK(BinaryCompareOp);
+BENCHMARK(BinaryBitOp);
+BENCHMARK(UnaryOp);
+BENCHMARK(Constants);
} // namespace Decimal
} // namespace arrow