Benchmark calling BitReader::GetValue() in a loop to unpack 32 * 'batch_size' values.
| 407 | |
| 408 | /// Benchmark calling BitReader::GetValue() in a loop to unpack 32 * 'batch_size' values. |
| 409 | void BitReaderBenchmark(int batch_size, void* data) { |
| 410 | const BenchmarkParams* p = reinterpret_cast<BenchmarkParams*>(data); |
| 411 | BitReader reader(p->data, p->data_len); |
| 412 | for (int i = 0; i < batch_size; ++i) { |
| 413 | for (int j = 0; j < 32; ++j) { |
| 414 | const int64_t offset = (i * 32 + j) % NUM_OUT_VALUES; |
| 415 | if (UNLIKELY(!reader.GetValue<uint32_t>(p->bit_width, &out_buffer[offset]))) { |
| 416 | reader.Reset(p->data, p->data_len); |
| 417 | const bool success = reader.GetValue<uint32_t>(p->bit_width, &out_buffer[offset]); |
| 418 | DCHECK(success); |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | /// Benchmark calling Unpack32Values() in a loop to unpack 32 * 'batch_size' values. |
| 425 | void Unpack32Benchmark(int batch_size, void* data) { |