Benchmark支持功能標(biāo)桿管理的庫(kù)
Benchmark 是一個(gè)支持功能標(biāo)桿管理的庫(kù),類似于單元測(cè)試。
示例代碼:
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();評(píng)論
圖片
表情
