1 #include "benchmark/benchmark.h" 2 BM_StringCreation(benchmark::State & state)3void BM_StringCreation(benchmark::State& state) { 4 while (state.KeepRunning()) 5 std::string empty_string; 6 } 7 8 BENCHMARK(BM_StringCreation); 9 BM_StringCopy(benchmark::State & state)10void BM_StringCopy(benchmark::State& state) { 11 std::string x = "hello"; 12 while (state.KeepRunning()) 13 std::string copy(x); 14 } 15 16 BENCHMARK(BM_StringCopy); 17 18 BENCHMARK_MAIN(); 19