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

Function BenchmarkGenerateBits

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

Source from the content-addressed store, hash-verified

315
316template <typename GenerateBitsFunctorType>
317static void BenchmarkGenerateBits(benchmark::State& state, int64_t nbytes) {
318 std::shared_ptr<Buffer> buffer = CreateRandomBuffer(nbytes);
319
320 const int64_t num_bits = nbytes * 8;
321 uint8_t* bitmap = buffer->mutable_data();
322
323 while (state.KeepRunning()) {
324 int64_t pattern_index = 0;
325 const auto generate = [&]() -> bool {
326 bool b = pattern[pattern_index++];
327 if (pattern_index == sizeof(pattern) / sizeof(bool)) {
328 pattern_index = 0;
329 }
330 return b;
331 };
332 GenerateBitsFunctorType()(bitmap, 0, num_bits, generate);
333 benchmark::ClobberMemory();
334 }
335 state.SetBytesProcessed(state.iterations() * nbytes);
336}
337
338static void BitmapReader(benchmark::State& state) {
339 BenchmarkBitmapReader<internal::BitmapReader>(state, state.range(0));

Callers

nothing calls this directly

Calls 2

CreateRandomBufferFunction · 0.70
mutable_dataMethod · 0.45

Tested by

no test coverage detected