Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -18,7 +18,7 @@ static std::string createFunctionJSON(size_t stopCount) {
std::string value = std::to_string(100.0f / stopCount * innerStop);
if (stops.size() > 1) stops += ",";
stops += R"([{"zoom":)" + zoom + R"(,"value":)" + value + "}, " + value + "]";
stops += R"([{"zoom":)" + zoom + R"(,"value":)" + value + "}, " + value + "]";
}
}
stops += "]";
@@ -33,7 +33,8 @@ static void Parse_CompositeFunction(benchmark::State& state) {
state.PauseTiming();
auto doc = createFunctionJSON(stopCount);
state.ResumeTiming();
std::optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false);
std::optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(
doc, error, true, false);
if (!result) {
state.SkipWithError(error.message.c_str());
}
@@ -45,23 +46,21 @@ static void Evaluate_CompositeFunction(benchmark::State& state) {
size_t stopCount = state.range(0);
auto doc = createFunctionJSON(stopCount);
conversion::Error error;
std::optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false);
std::optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(
doc, error, true, false);
if (!function) {
state.SkipWithError(error.message.c_str());
}
while(state.KeepRunning()) {
while (state.KeepRunning()) {
float z = 24.0f * static_cast<float>(rand() % 100) / 100;
function->asExpression().evaluate(z, StubGeometryTileFeature(PropertyMap { { "x", static_cast<int64_t>(rand() % 100) } }), -1.0f);
function->asExpression().evaluate(
z, StubGeometryTileFeature(PropertyMap{{"x", static_cast<int64_t>(rand() % 100)}}), -1.0f);
}
state.SetLabel(std::to_string(stopCount).c_str());
}
BENCHMARK(Parse_CompositeFunction)
->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12);
BENCHMARK(Evaluate_CompositeFunction)
->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12);
BENCHMARK(Parse_CompositeFunction)->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12);
BENCHMARK(Evaluate_CompositeFunction)->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12);