| 47 | } |
| 48 | |
| 49 | void 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 | |
| 67 | void BM_CastDispatchBaseline(benchmark::State& state) { |
| 68 | // Repeatedly invoke a trivial Cast with all dispatch outside the hot loop |
nothing calls this directly
no test coverage detected