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

Function BenchmarkDictionaryArray

cpp/src/arrow/builder_benchmark.cc:347–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346template <class DictionaryBuilderType, class Scalar>
347static void BenchmarkDictionaryArray(
348 benchmark::State& state, // NOLINT non-const reference
349 const std::vector<Scalar>& fodder, size_t fodder_nbytes = 0) {
350 for (auto _ : state) {
351 DictionaryBuilderType builder(memory_tracker.memory_pool());
352
353 for (int64_t i = 0; i < kRounds; i++) {
354 for (const auto& value : fodder) {
355 ABORT_NOT_OK(builder.Append(value));
356 }
357 }
358
359 std::shared_ptr<Array> out;
360 ABORT_NOT_OK(builder.Finish(&out));
361 }
362
363 if (fodder_nbytes == 0) {
364 fodder_nbytes = fodder.size() * sizeof(Scalar);
365 }
366 state.SetBytesProcessed(state.iterations() * fodder_nbytes * kRounds);
367 state.SetItemsProcessed(state.iterations() * fodder.size() * kRounds);
368}
369
370static void BuildInt64DictionaryArrayRandom(
371 benchmark::State& state) { // NOLINT non-const reference

Callers

nothing calls this directly

Calls 4

memory_poolMethod · 0.45
AppendMethod · 0.45
FinishMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected