BENCHMARK_PARAM

Defines a benchmark that passes a parameter to another one. This is common for benchmarks that need a "problem size" in addition to "number of iterations". Consider:

Synopsis

Declared in <folly/Benchmark.h>

#define BENCHMARK_PARAM(name, param)

Description

void pushBack(uint32_t n, size_t initialSize) { vector<int> v; BENCHMARK_SUSPEND { v.resize(initialSize); } for (uint32_t i = 0; i < n; ++i) { v.push_back(i); } } BENCHMARK_PARAM(pushBack, 0) BENCHMARK_PARAM(pushBack, 1000) BENCHMARK_PARAM(pushBack, 1000000)

The benchmark above estimates the speed of push_back at different initial sizes of the vector. The framework will pass 0, 1000, and 1000000 for initialSize, and the iteration count for n.

Parameters

NameDescription
nameThe benchmarked function's identifier.
paramThe parameter value passed to the benchmarked function.