cpp/src/arrow/memory_pool_benchmark.cc
// Benchmark the cost of accessing always the same memory area.
// This gives us a lower bound of the potential difference between
// AllocateTouchDeallocate and AllocateDeallocate.
Benchmark the cost of accessing always the same memory area.
This gives us a lower bound of the potential difference between
AllocateTouchDeallocate and AllocateDeallocate.
Benchmark the cost of accessing always the same memory area . This gives us a lower bound of the potential difference between AllocateTouchDeallocate and AllocateDeallocate .
static void TouchArea(benchmark::State& state) {  
  const int64_t nbytes = state.range(0);
  MemoryPool* pool = default_memory_pool();
  uint8_t* data;
  ARROW_CHECK_OK(pool->Allocate(nbytes, &data));
  for (auto _ : state) {
    TouchCacheLines(data, nbytes);
  }
  pool->Free(data, nbytes);
}
static void TouchArea ( benchmark :: State & state ) { const int64_t nbytes = state . range ( 0 ) ; MemoryPool * pool = default_memory_pool ( ) ; uint8_t * data ; ARROW_CHECK_OK ( pool -> Allocate ( nbytes , & data ) ) ; for ( auto _ : state ) { TouchCacheLines ( data , nbytes ) ; } pool -> Free ( data , nbytes ) ; }
Benchmark the cost of accessing always the same memory area.
Benchmark the cost of accessing always the same memory area .
// NOLINT non-const reference