BENCHMARK

Introduces a benchmark function. Use with either one or two arguments. The first is the name of the benchmark. Use something descriptive, such as insertVectorBegin. The second argument may be missing, or could be a symbolic counter. The counter dictates how many internal iteration the benchmark does. Example:

Synopsis

Declared in <folly/Benchmark.h>

#define BENCHMARK(name, ...)

Description

BENCHMARK(vectorPushBack) { vector<int> v; v.push_back(42); }

BENCHMARK(insertVectorBegin, iters) { vector<int> v; for (unsigned int i = 0; i < iters; ++i) { v.insert(v.begin(), 42); } }

Parameters

NameDescription
nameThe benchmark's name, also used as its function identifier.