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

Function lazy_postinc

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

For loop with a post-increment of a lazy operator

Source from the content-addressed store, hash-verified

112
113// For loop with a post-increment of a lazy operator
114void lazy_postinc(benchmark::State& state) {
115 auto source = generate_junk(kSize);
116 std::vector<int> target(kSize);
117 auto lazy_range = internal::MakeLazyRange(
118 [&source](int64_t index) { return source[index]; }, source.size());
119
120 for (auto _ : state) {
121 auto lazy_iter = lazy_range.begin();
122 auto lazy_end = lazy_range.end();
123 auto target_iter = target.begin();
124
125 while (lazy_iter != lazy_end) *(target_iter++) = *(lazy_iter++);
126 }
127 state.SetItemsProcessed(state.iterations() * kSize);
128}
129
130BENCHMARK(lazy_postinc);
131

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected