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

Function BenchmarkArrayRangeEquals

cpp/src/arrow/compare_benchmark.cc:36–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34constexpr auto kSeed = 0x94378165;
35
36static void BenchmarkArrayRangeEquals(const std::shared_ptr<Array>& array,
37 benchmark::State& state) {
38 const auto left_array = array;
39 // Make sure pointer equality can't be used as a shortcut
40 // (should we would deep-copy child_data and buffers?)
41 const auto right_array =
42 MakeArray(array->data()->Copy())->Slice(1, array->length() - 1);
43
44 for (auto _ : state) {
45 const bool are_ok = ArrayRangeEquals(*left_array, *right_array,
46 /*left_start_idx=*/1,
47 /*left_end_idx=*/array->length() - 2,
48 /*right_start_idx=*/0);
49 if (ARROW_PREDICT_FALSE(!are_ok)) {
50 ARROW_LOG(FATAL) << "Arrays should have compared equal";
51 }
52 }
53}
54
55static void ArrayRangeEqualsInt32(benchmark::State& state) {
56 RegressionArgs args(state, /*size_is_bytes=*/false);

Callers 9

ArrayRangeEqualsInt32Function · 0.85
ArrayRangeEqualsFloat32Function · 0.85
ArrayRangeEqualsBooleanFunction · 0.85
ArrayRangeEqualsStringFunction · 0.85
ArrayRangeEqualsStructFunction · 0.85

Calls 6

ArrayRangeEqualsFunction · 0.85
MakeArrayFunction · 0.50
SliceMethod · 0.45
CopyMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected