.. _program_listing_file_Test_perf_perfSuite.cpp: Program Listing for File perfSuite.cpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``Test/perf/perfSuite.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include static void BM_StringCreation(benchmark::State &state) { for (auto _ : state) std::string empty_string; } // Register the function as a benchmark BENCHMARK(BM_StringCreation); // Define another benchmark static void BM_StringCopy(benchmark::State &state) { std::string x = "hello"; for (auto _ : state) std::string copy(x); } BENCHMARK(BM_StringCopy); BENCHMARK_MAIN();