json/benchmarks/thirdparty/benchmark/conan/test_package/test_package.cpp

19 lines
368 B
C++
Raw Normal View History

2021-01-23 15:59:52 +03:00
#include "benchmark/benchmark.h"
void BM_StringCreation(benchmark::State& state) {
while (state.KeepRunning())
std::string empty_string;
}
BENCHMARK(BM_StringCreation);
void BM_StringCopy(benchmark::State& state) {
std::string x = "hello";
while (state.KeepRunning())
std::string copy(x);
}
BENCHMARK(BM_StringCopy);
BENCHMARK_MAIN();