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

Function ToScalars

cpp/src/arrow/compute/function_benchmark.cc:40–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38constexpr int64_t kScalarCount = 1 << 10;
39
40inline ScalarVector ToScalars(std::shared_ptr<Array> arr) {
41 ScalarVector scalars{static_cast<size_t>(arr->length())};
42 int64_t i = 0;
43 for (auto& scalar : scalars) {
44 scalar = arr->GetScalar(i++).ValueOrDie();
45 }
46 return scalars;
47}
48
49void BM_CastDispatch(benchmark::State& state) {
50 // Repeatedly invoke a trivial Cast: the main cost should be dispatch

Callers 1

BM_CastDispatchFunction · 0.85

Calls 3

ValueOrDieMethod · 0.80
lengthMethod · 0.45
GetScalarMethod · 0.45

Tested by

no test coverage detected