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

Function lazy_copy_converting

cpp/src/arrow/util/range_benchmark.cc:98–109  ·  view source on GitHub ↗

std::copy with a lazy range which does static cast. Should be the same performance as std::copy with differently typed iterators

Source from the content-addressed store, hash-verified

96// std::copy with a lazy range which does static cast.
97// Should be the same performance as std::copy with differently typed iterators
98void lazy_copy_converting(benchmark::State& state) {
99 auto source = generate_junk<int64_t>(kSize);
100 std::vector<int32_t> target(kSize);
101 auto lazy_range = internal::MakeLazyRange(
102 [&source](int64_t index) { return static_cast<int32_t>(source[index]); },
103 source.size());
104
105 for (auto _ : state) {
106 std::copy(lazy_range.begin(), lazy_range.end(), target.begin());
107 }
108 state.SetItemsProcessed(state.iterations() * kSize);
109}
110
111BENCHMARK(lazy_copy_converting);
112

Callers

nothing calls this directly

Calls 4

MakeLazyRangeFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected