MCPcopy Create free account
hub / github.com/apache/arrow / BinaryCompareOp

Function BinaryCompareOp

cpp/src/arrow/util/decimal_benchmark.cc:82–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80constexpr int32_t kValueSize = 12;
81
82static void BinaryCompareOp(benchmark::State& state) { // NOLINT non-const reference
83 std::vector<BasicDecimal128> v1, v2;
84 for (int x = 0; x < kValueSize; x++) {
85 v1.emplace_back(100 + x, 100 + x);
86 v2.emplace_back(200 + x, 200 + x);
87 }
88 static_assert(kValueSize % 4 == 0,
89 "kValueSize needs to be a multiple of 4 to avoid out-of-bounds accesses");
90 for (auto _ : state) {
91 for (int x = 0; x < kValueSize; x += 4) {
92 auto equal = v1[x] == v2[x];
93 benchmark::DoNotOptimize(equal);
94 auto less_than_or_equal = v1[x + 1] <= v2[x + 1];
95 benchmark::DoNotOptimize(less_than_or_equal);
96 auto greater_than_or_equal1 = v1[x + 2] >= v2[x + 2];
97 benchmark::DoNotOptimize(greater_than_or_equal1);
98 auto greater_than_or_equal2 = v1[x + 3] >= v2[x + 3];
99 benchmark::DoNotOptimize(greater_than_or_equal2);
100 }
101 }
102 state.SetItemsProcessed(state.iterations() * kValueSize);
103}
104
105static void BinaryCompareOpConstant(
106 benchmark::State& state) { // NOLINT non-const reference

Callers

nothing calls this directly

Calls 1

emplace_backMethod · 0.80

Tested by

no test coverage detected