Benchmark支持功能标杆管理的库
Benchmark 是一个支持功能标杆管理的库,类似于单元测试。
示例代码:
static void BM_StringCreation(benchmark::State& state)
{ while (state.KeepRunning())
std::string empty_string;
}
// Register the function as a benchmarkBENCHMARK(BM_StringCreation);
// Define another benchmarkstatic void BM_StringCopy(benchmark::State& state)
{
std::string x = "hello"; while (state.KeepRunning())
std::string copy(x);
}BENCHMARK(BM_StringCopy);
BENCHMARK_MAIN();评论
