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

Function BitBlockCounterBench

cpp/src/arrow/util/bitmap_reader_benchmark.cc:52–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52static void BitBlockCounterBench(benchmark::State& state) {
53 int64_t nbytes = state.range(0);
54 std::shared_ptr<Buffer> cond_buf = CreateRandomBuffer(nbytes);
55 for (auto _ : state) {
56 BitBlockCounter counter(cond_buf->data(), 0, nbytes * 8);
57
58 int64_t offset = 0;
59 uint64_t set_bits = 0;
60
61 while (offset < nbytes * 8) {
62 const BitBlockCount& word = counter.NextWord();
63 // if (word.AllSet()) {
64 // set_bits += word.length;
65 // } else if (word.popcount) {
66 // set_bits += word.popcount;
67 // }
68 set_bits += word.popcount;
69 benchmark::DoNotOptimize(set_bits);
70 offset += word.length;
71 }
72 benchmark::ClobberMemory();
73 }
74
75 state.SetBytesProcessed(state.iterations() * nbytes);
76}
77
78static void BitmapWordReaderBench(benchmark::State& state) {
79 int64_t nbytes = state.range(0);

Callers

nothing calls this directly

Calls 3

CreateRandomBufferFunction · 0.70
dataMethod · 0.45
NextWordMethod · 0.45

Tested by

no test coverage detected