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

Function RoundArrayBenchmark

cpp/src/arrow/compute/kernels/scalar_round_benchmark.cc:64–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62template <UnaryOp& Op, typename ArrowType, RoundMode Mode,
63 typename CType = typename ArrowType::c_type>
64static void RoundArrayBenchmark(benchmark::State& state) {
65 RegressionArgs args(state);
66
67 const int64_t array_size = args.size / sizeof(CType);
68 auto rand = random::RandomArrayGenerator(kSeed);
69
70 // Choose values so as to avoid overflow on all ops and types.
71 auto min = static_cast<CType>(6);
72 auto max = static_cast<CType>(min + 15);
73 auto val = std::static_pointer_cast<NumericArray<ArrowType>>(
74 rand.Numeric<ArrowType>(array_size, min, max, args.null_proportion));
75 RoundOptions options;
76 options.round_mode = static_cast<RoundMode>(Mode);
77 options.ndigits = 1;
78
79 for (auto _ : state) {
80 ABORT_NOT_OK(Op(val, options, NULLPTR));
81 }
82 state.SetItemsProcessed(state.iterations() * array_size);
83}
84
85template <BinaryOp& Op, typename ArrowType, RoundMode Mode,
86 typename CType = typename ArrowType::c_type>

Callers

nothing calls this directly

Calls 1

OpClass · 0.50

Tested by

no test coverage detected