| 416 | // BufferBuilder benchmarks |
| 417 | |
| 418 | static void BenchmarkBufferBuilder( |
| 419 | const std::string& datum, |
| 420 | benchmark::State& state) { // NOLINT non-const reference |
| 421 | const void* raw_data = datum.data(); |
| 422 | int64_t raw_nbytes = static_cast<int64_t>(datum.size()); |
| 423 | // Write approx. 256 MB to BufferBuilder |
| 424 | int64_t num_raw_values = (1 << 28) / raw_nbytes; |
| 425 | for (auto _ : state) { |
| 426 | BufferBuilder builder(memory_tracker.memory_pool()); |
| 427 | std::shared_ptr<Buffer> buf; |
| 428 | for (int64_t i = 0; i < num_raw_values; ++i) { |
| 429 | ABORT_NOT_OK(builder.Append(raw_data, raw_nbytes)); |
| 430 | } |
| 431 | ABORT_NOT_OK(builder.Finish(&buf)); |
| 432 | } |
| 433 | state.SetBytesProcessed(int64_t(state.iterations()) * num_raw_values * raw_nbytes); |
| 434 | } |
| 435 | |
| 436 | static void BufferBuilderTinyWrites( |
| 437 | benchmark::State& state) { // NOLINT non-const reference |
no test coverage detected