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

Function BenchmarkBitmapWriter

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

Source from the content-addressed store, hash-verified

288
289template <typename BitmapWriterType>
290static void BenchmarkBitmapWriter(benchmark::State& state, int64_t nbytes) {
291 std::shared_ptr<Buffer> buffer = CreateRandomBuffer(nbytes);
292
293 const int64_t num_bits = nbytes * 8;
294 uint8_t* bitmap = buffer->mutable_data();
295
296 for (auto _ : state) {
297 BitmapWriterType writer(bitmap, 0, num_bits);
298 int64_t pattern_index = 0;
299 for (int64_t i = 0; i < num_bits; i++) {
300 if (pattern[pattern_index++]) {
301 writer.Set();
302 } else {
303 writer.Clear();
304 }
305 if (pattern_index == sizeof(pattern) / sizeof(bool)) {
306 pattern_index = 0;
307 }
308 writer.Next();
309 }
310 writer.Finish();
311 benchmark::ClobberMemory();
312 }
313 state.SetBytesProcessed(state.iterations() * nbytes);
314}
315
316template <typename GenerateBitsFunctorType>
317static void BenchmarkGenerateBits(benchmark::State& state, int64_t nbytes) {

Callers

nothing calls this directly

Calls 6

CreateRandomBufferFunction · 0.70
mutable_dataMethod · 0.45
SetMethod · 0.45
ClearMethod · 0.45
NextMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected