Benchmarks SkipRecords for RecordReader with the following parameters in order: - repetition: 0 for REQUIRED, 1 for OPTIONAL, 2 for REPEATED. - batch_size: sets how many values to read at each call.
| 176 | // - repetition: 0 for REQUIRED, 1 for OPTIONAL, 2 for REPEATED. |
| 177 | // - batch_size: sets how many values to read at each call. |
| 178 | static void RecordReaderSkipRecords(::benchmark::State& state) { |
| 179 | const auto repetition = static_cast<Repetition::type>(state.range(0)); |
| 180 | const auto batch_size = static_cast<int64_t>(state.range(1)); |
| 181 | |
| 182 | BenchmarkHelper helper(repetition, /*num_pages=*/16, /*levels_per_page=*/80000); |
| 183 | |
| 184 | // Vectors to read the values into. |
| 185 | for (auto _ : state) { |
| 186 | state.PauseTiming(); |
| 187 | // read_dense_for_nullable should not matter for skip. |
| 188 | RecordReader* reader = helper.ResetRecordReader(/*read_dense_for_nullable=*/false); |
| 189 | int64_t records_skipped = -1; |
| 190 | state.ResumeTiming(); |
| 191 | while (records_skipped != 0) { |
| 192 | DoNotOptimize(records_skipped = reader->SkipRecords(batch_size)); |
| 193 | reader->Reset(); |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | state.SetBytesProcessed(state.iterations() * helper.total_size()); |
| 198 | state.SetItemsProcessed(state.iterations() * helper.total_levels()); |
| 199 | } |
| 200 | |
| 201 | // Benchmarks ReadRecords and SkipRecords for RecordReader with the following parameters |
| 202 | // in order: |
nothing calls this directly
no test coverage detected