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

Function BM_CastDispatch

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

Source from the content-addressed store, hash-verified

47}
48
49void BM_CastDispatch(benchmark::State& state) {
50 // Repeatedly invoke a trivial Cast: the main cost should be dispatch
51 random::RandomArrayGenerator rag(kSeed);
52
53 auto int_scalars = ToScalars(rag.Int64(kScalarCount, 0, 1 << 20));
54
55 auto double_type = float64();
56 for (auto _ : state) {
57 Datum timestamp_scalar;
58 for (Datum int_scalar : int_scalars) {
59 ASSERT_OK_AND_ASSIGN(timestamp_scalar, Cast(int_scalar, double_type));
60 }
61 benchmark::DoNotOptimize(timestamp_scalar);
62 }
63
64 state.SetItemsProcessed(state.iterations() * kScalarCount);
65}
66
67void BM_CastDispatchBaseline(benchmark::State& state) {
68 // Repeatedly invoke a trivial Cast with all dispatch outside the hot loop

Callers

nothing calls this directly

Calls 4

ToScalarsFunction · 0.85
CastFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
Int64Method · 0.45

Tested by

no test coverage detected