| 85 | // temporary buffers for intermediate computation results. |
| 86 | template <typename Alloc> |
| 87 | static void AllocateDeallocate(benchmark::State& state) { // NOLINT non-const reference |
| 88 | const int64_t nbytes = state.range(0); |
| 89 | MemoryPool* pool = *Alloc::GetAllocator(); |
| 90 | |
| 91 | for (auto _ : state) { |
| 92 | uint8_t* data; |
| 93 | ARROW_CHECK_OK(pool->Allocate(nbytes, &data)); |
| 94 | pool->Free(data, nbytes); |
| 95 | } |
| 96 | state.SetItemsProcessed(state.iterations()); |
| 97 | // SetBytesProcessed() would give nonsensical figures since the data is not |
| 98 | // actually processed. |
| 99 | } |
| 100 | |
| 101 | // Benchmark the cost of allocating memory plus accessing it. |
| 102 | template <typename Alloc> |