jeudi 28 novembre 2019

What happens to the return values while using Google Benchmark?

Below is an example from the Google benchmark repository. The same can also be found on the quick-bench

1 static void BM_StringCopy(benchmark::State& state) {
2 std::string x = "hello";
3 for (auto _ : state)
4  std::string copy(x);
5 }
6 
7 BENCHMARK(BM_StringCopy);

I am trying to understand 2 things here.

  1. Which function does copy in line 4 call? and How do I know this? The call does not look like the one from the C++ standard. Rather, looks like a free function.

  2. What happens to the return values of the function being benchmarked? I have functions that return std::map. Should I ignore these return values?

Aucun commentaire:

Enregistrer un commentaire