static void Bench_Name(benchmark::State& state) { const char* f = "Eeeee"; for (auto _ : state) { // Make sure the variable is not optimized away by compiler benchmark::DoNotOptimize(GetTByName(f)); } } static void Bench_Name2(benchmark::State& state) { std::string_view f = "Eeeee"; for (auto _ : state) { // Make sure the variable is not optimized away by compiler benchmark::DoNotOptimize(GetByName2(f)); } } BENCHMARK(Bench_Name); BENCHMARK(Bench_Name2);