summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-07-13 18:14:12 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-07-20 11:56:30 -0700
commitc8edbb0500cbf4baf1d5fdb0e63679539e166585 (patch)
tree750f3b72b9e3b1c91ddbc0541cfc64d7d80ffe71 /benchmark
parent6d7072162b764c2432c010cd463a5a2c0093d606 (diff)
downloadqtlocation-mapboxgl-c8edbb0500cbf4baf1d5fdb0e63679539e166585.tar.gz
[core] Replace {Source,Camera,Composite}Function with PropertyExpression
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/function/camera_function.benchmark.cpp8
-rw-r--r--benchmark/function/composite_function.benchmark.cpp9
-rw-r--r--benchmark/function/source_function.benchmark.cpp10
3 files changed, 12 insertions, 15 deletions
diff --git a/benchmark/function/camera_function.benchmark.cpp b/benchmark/function/camera_function.benchmark.cpp
index 26de5701db..52b6bc9f08 100644
--- a/benchmark/function/camera_function.benchmark.cpp
+++ b/benchmark/function/camera_function.benchmark.cpp
@@ -1,9 +1,9 @@
#include <benchmark/benchmark.h>
-#include <mbgl/style/function/source_function.hpp>
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/function.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
using namespace mbgl;
using namespace mbgl::style;
@@ -27,7 +27,7 @@ static void Parse_CameraFunction(benchmark::State& state) {
state.PauseTiming();
auto doc = createFunctionJSON(stopCount);
state.ResumeTiming();
- optional<CameraFunction<float>> result = conversion::convertJSON<CameraFunction<float>>(doc, error);
+ optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error);
if (!result) {
state.SkipWithError(error.message.c_str());
}
@@ -39,14 +39,14 @@ static void Evaluate_CameraFunction(benchmark::State& state) {
size_t stopCount = state.range(0);
auto doc = createFunctionJSON(stopCount);
conversion::Error error;
- optional<CameraFunction<float>> function = conversion::convertJSON<CameraFunction<float>>(doc, error);
+ optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error);
if (!function) {
state.SkipWithError(error.message.c_str());
}
while(state.KeepRunning()) {
float z = 24.0f * static_cast<float>(rand() % 100) / 100;
- function->evaluate(z);
+ function->asExpression().evaluate(z);
}
state.SetLabel(std::to_string(stopCount).c_str());
diff --git a/benchmark/function/composite_function.benchmark.cpp b/benchmark/function/composite_function.benchmark.cpp
index 8442e0aa15..77258669a5 100644
--- a/benchmark/function/composite_function.benchmark.cpp
+++ b/benchmark/function/composite_function.benchmark.cpp
@@ -2,11 +2,10 @@
#include <mbgl/benchmark/stub_geometry_tile_feature.hpp>
-#include <mbgl/style/function/composite_function.hpp>
-
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/function.hpp>
+#include <mbgl/style/conversion/data_driven_property_value.hpp>
using namespace mbgl;
using namespace mbgl::style;
@@ -34,7 +33,7 @@ static void Parse_CompositeFunction(benchmark::State& state) {
state.PauseTiming();
auto doc = createFunctionJSON(stopCount);
state.ResumeTiming();
- optional<CompositeFunction<float>> result = conversion::convertJSON<style::CompositeFunction<float>>(doc, error);
+ optional<DataDrivenPropertyValue<float>> result = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error);
if (!result) {
state.SkipWithError(error.message.c_str());
}
@@ -46,14 +45,14 @@ static void Evaluate_CompositeFunction(benchmark::State& state) {
size_t stopCount = state.range(0);
auto doc = createFunctionJSON(stopCount);
conversion::Error error;
- optional<CompositeFunction<float>> function = conversion::convertJSON<CompositeFunction<float>>(doc, error);
+ optional<DataDrivenPropertyValue<float>> function = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error);
if (!function) {
state.SkipWithError(error.message.c_str());
}
while(state.KeepRunning()) {
float z = 24.0f * static_cast<float>(rand() % 100) / 100;
- function->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());
diff --git a/benchmark/function/source_function.benchmark.cpp b/benchmark/function/source_function.benchmark.cpp
index af361943e3..402c9b89d2 100644
--- a/benchmark/function/source_function.benchmark.cpp
+++ b/benchmark/function/source_function.benchmark.cpp
@@ -2,11 +2,9 @@
#include <mbgl/benchmark/stub_geometry_tile_feature.hpp>
-#include <mbgl/style/function/source_function.hpp>
-
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/json.hpp>
-#include <mbgl/style/conversion/function.hpp>
+#include <mbgl/style/conversion/data_driven_property_value.hpp>
using namespace mbgl;
using namespace mbgl::style;
@@ -30,7 +28,7 @@ static void Parse_SourceFunction(benchmark::State& state) {
state.PauseTiming();
auto doc = createFunctionJSON(stopCount);
state.ResumeTiming();
- optional<SourceFunction<float>> result = conversion::convertJSON<SourceFunction<float>>(doc, error);
+ optional<DataDrivenPropertyValue<float>> result = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error);
if (!result) {
state.SkipWithError(error.message.c_str());
}
@@ -42,13 +40,13 @@ static void Evaluate_SourceFunction(benchmark::State& state) {
size_t stopCount = state.range(0);
auto doc = createFunctionJSON(stopCount);
conversion::Error error;
- optional<SourceFunction<float>> function = conversion::convertJSON<SourceFunction<float>>(doc, error);
+ optional<DataDrivenPropertyValue<float>> function = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error);
if (!function) {
state.SkipWithError(error.message.c_str());
}
while(state.KeepRunning()) {
- function->evaluate(StubGeometryTileFeature(PropertyMap { { "x", static_cast<int64_t>(rand() % 100) } }), -1.0f);
+ function->asExpression().evaluate(StubGeometryTileFeature(PropertyMap { { "x", static_cast<int64_t>(rand() % 100) } }), -1.0f);
}
state.SetLabel(std::to_string(stopCount).c_str());