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.
-
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. -
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