You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
368 B
19 lines
368 B
7 months ago
|
#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();
|