| 189 | |
| 190 | template <typename BitmapReaderType> |
| 191 | static 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 | |
| 220 | template <typename BitRunReaderType> |
| 221 | static void BenchmarkBitRunReader(benchmark::State& state, int64_t set_percentage) { |
nothing calls this directly
no test coverage detected