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

Function BenchmarkBitmapReader

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

Source from the content-addressed store, hash-verified

189
190template <typename BitmapReaderType>
191static void BenchmarkBitmapReader(benchmark::State& state, int64_t nbytes) {
192 std::shared_ptr<Buffer> buffer = CreateRandomBuffer(nbytes);
193
194 const int64_t num_bits = nbytes * 8;
195 const uint8_t* bitmap = buffer->data();
196
197 for (auto _ : state) {
198 {
199 BitmapReaderType reader(bitmap, 0, num_bits);
200 int64_t total = 0;
201 for (int64_t i = 0; i < num_bits; i++) {
202 total += reader.IsSet();
203 reader.Next();
204 }
205 benchmark::DoNotOptimize(total);
206 }
207 {
208 BitmapReaderType reader(bitmap, 0, num_bits);
209 int64_t total = 0;
210 for (int64_t i = 0; i < num_bits; i++) {
211 total += !reader.IsNotSet();
212 reader.Next();
213 }
214 benchmark::DoNotOptimize(total);
215 }
216 }
217 state.SetBytesProcessed(2LL * state.iterations() * nbytes);
218}
219
220template <typename BitRunReaderType>
221static void BenchmarkBitRunReader(benchmark::State& state, int64_t set_percentage) {

Callers

nothing calls this directly

Calls 5

CreateRandomBufferFunction · 0.70
dataMethod · 0.45
IsSetMethod · 0.45
NextMethod · 0.45
IsNotSetMethod · 0.45

Tested by

no test coverage detected