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

Function BenchmarkVisitBits

cpp/src/arrow/util/bit_util_benchmark.cc:261–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260template <typename VisitBitsFunctorType>
261static void BenchmarkVisitBits(benchmark::State& state, int64_t nbytes) {
262 std::shared_ptr<Buffer> buffer = CreateRandomBuffer(nbytes);
263
264 const int64_t num_bits = nbytes * 8;
265 const uint8_t* bitmap = buffer->data();
266
267 for (auto _ : state) {
268 {
269 int64_t total = 0;
270 const auto visit = [&total](bool value) -> void { total += value; };
271 VisitBitsFunctorType()(bitmap, 0, num_bits, visit);
272 benchmark::DoNotOptimize(total);
273 }
274 {
275 int64_t total = 0;
276 const auto visit = [&total](bool value) -> void { total += value; };
277 VisitBitsFunctorType()(bitmap, 0, num_bits, visit);
278 benchmark::DoNotOptimize(total);
279 }
280 }
281 state.SetBytesProcessed(2LL * state.iterations() * nbytes);
282}
283
284constexpr bool pattern[] = {false, false, false, true, true, true};
285static_assert(

Callers

nothing calls this directly

Calls 2

CreateRandomBufferFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected