diff options
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/api/query.benchmark.cpp | 2 | ||||
-rw-r--r-- | benchmark/api/render.benchmark.cpp | 6 | ||||
-rw-r--r-- | benchmark/function/camera_function.benchmark.cpp | 18 | ||||
-rw-r--r-- | benchmark/function/composite_function.benchmark.cpp | 17 | ||||
-rw-r--r-- | benchmark/function/source_function.benchmark.cpp | 17 | ||||
-rw-r--r-- | benchmark/parse/filter.benchmark.cpp | 8 |
6 files changed, 21 insertions, 47 deletions
diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 75695c1ad7..7694585526 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -34,7 +34,7 @@ public: DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." }; ThreadPool threadPool{ 4 }; HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSource, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, fileSource, threadPool, MapMode::Still }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, fileSource, threadPool, MapMode::Static}; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; }; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 9f1ea68e0b..a1b557777f 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -41,7 +41,7 @@ static void prepare(Map& map, optional<std::string> json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; prepare(map); while (state.KeepRunning()) { @@ -52,7 +52,7 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; while (state.KeepRunning()) { prepare(map, { "{}" }); @@ -67,7 +67,7 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { while (state.KeepRunning()) { HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; prepare(map); frontend.render(map); } diff --git a/benchmark/function/camera_function.benchmark.cpp b/benchmark/function/camera_function.benchmark.cpp index 1f8fe4579f..26de5701db 100644 --- a/benchmark/function/camera_function.benchmark.cpp +++ b/benchmark/function/camera_function.benchmark.cpp @@ -1,20 +1,14 @@ #include <benchmark/benchmark.h> #include <mbgl/style/function/source_function.hpp> - -#include <mbgl/style/rapidjson_conversion.hpp> #include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/function.hpp> -#include <rapidjson/document.h> - - using namespace mbgl; using namespace mbgl::style; -static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> createFunctionJSON(size_t stopCount) { - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc; - +static std::string createFunctionJSON(size_t stopCount) { std::string stops = "["; for (size_t i = 0; i < stopCount; i++) { std::string value = std::to_string(24.0f / stopCount * i); @@ -22,9 +16,7 @@ static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> cr stops += "[" + value + ", " + value + "]"; } stops += "]"; - - doc.Parse<0>(R"({"type": "exponential", "base": 2, "stops": )" + stops + "}"); - return doc; + return R"({"type": "exponential", "base": 2, "stops": )" + stops + "}"; } static void Parse_CameraFunction(benchmark::State& state) { @@ -35,7 +27,7 @@ static void Parse_CameraFunction(benchmark::State& state) { state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<CameraFunction<float>> result = conversion::convert<CameraFunction<float>, JSValue>(doc, error); + optional<CameraFunction<float>> result = conversion::convertJSON<CameraFunction<float>>(doc, error); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -47,7 +39,7 @@ 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::convert<CameraFunction<float>, JSValue>(doc, error); + optional<CameraFunction<float>> function = conversion::convertJSON<CameraFunction<float>>(doc, error); if (!function) { state.SkipWithError(error.message.c_str()); } diff --git a/benchmark/function/composite_function.benchmark.cpp b/benchmark/function/composite_function.benchmark.cpp index f04b6c7073..e2545e6349 100644 --- a/benchmark/function/composite_function.benchmark.cpp +++ b/benchmark/function/composite_function.benchmark.cpp @@ -5,19 +5,14 @@ #include <mbgl/style/function/composite_exponential_stops.hpp> #include <mbgl/style/function/composite_function.hpp> -#include <mbgl/style/rapidjson_conversion.hpp> #include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/function.hpp> -#include <rapidjson/document.h> - - using namespace mbgl; using namespace mbgl::style; -static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> createFunctionJSON(size_t stopCount) { - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc; - +static std::string createFunctionJSON(size_t stopCount) { std::string stops = "["; for (size_t outerStop = 0; outerStop < stopCount; outerStop++) { for (size_t innerStop = 0; innerStop < stopCount; innerStop++) { @@ -29,9 +24,7 @@ static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> cr } } stops += "]"; - - doc.Parse<0>(R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"); - return doc; + return R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"; } static void Parse_CompositeFunction(benchmark::State& state) { @@ -42,7 +35,7 @@ static void Parse_CompositeFunction(benchmark::State& state) { state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<CompositeFunction<float>> result = conversion::convert<style::CompositeFunction<float>, JSValue>(doc, error); + optional<CompositeFunction<float>> result = conversion::convertJSON<style::CompositeFunction<float>>(doc, error); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -54,7 +47,7 @@ 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::convert<CompositeFunction<float>, JSValue>(doc, error); + optional<CompositeFunction<float>> function = conversion::convertJSON<CompositeFunction<float>>(doc, error); if (!function) { state.SkipWithError(error.message.c_str()); } diff --git a/benchmark/function/source_function.benchmark.cpp b/benchmark/function/source_function.benchmark.cpp index 14e729eee2..af361943e3 100644 --- a/benchmark/function/source_function.benchmark.cpp +++ b/benchmark/function/source_function.benchmark.cpp @@ -4,19 +4,14 @@ #include <mbgl/style/function/source_function.hpp> -#include <mbgl/style/rapidjson_conversion.hpp> #include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/function.hpp> -#include <rapidjson/document.h> - - using namespace mbgl; using namespace mbgl::style; -static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> createFunctionJSON(size_t stopCount) { - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc; - +static std::string createFunctionJSON(size_t stopCount) { std::string stops = "["; for (size_t i = 0; i < stopCount; i++) { std::string value = std::to_string(100.0f / stopCount * i); @@ -24,9 +19,7 @@ static rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> cr stops += "[" + value + ", " + value + "]"; } stops += "]"; - - doc.Parse<0>(R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"); - return doc; + return R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"; } static void Parse_SourceFunction(benchmark::State& state) { @@ -37,7 +30,7 @@ static void Parse_SourceFunction(benchmark::State& state) { state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<SourceFunction<float>> result = conversion::convert<SourceFunction<float>, JSValue>(doc, error); + optional<SourceFunction<float>> result = conversion::convertJSON<SourceFunction<float>>(doc, error); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -49,7 +42,7 @@ 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::convert<SourceFunction<float>, JSValue>(doc, error); + optional<SourceFunction<float>> function = conversion::convertJSON<SourceFunction<float>>(doc, error); if (!function) { state.SkipWithError(error.message.c_str()); } diff --git a/benchmark/parse/filter.benchmark.cpp b/benchmark/parse/filter.benchmark.cpp index d650cb72c9..4984668400 100644 --- a/benchmark/parse/filter.benchmark.cpp +++ b/benchmark/parse/filter.benchmark.cpp @@ -2,20 +2,16 @@ #include <mbgl/style/filter.hpp> #include <mbgl/style/filter_evaluator.hpp> -#include <mbgl/style/rapidjson_conversion.hpp> #include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/filter.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <rapidjson/document.h> - using namespace mbgl; style::Filter parse(const char* expression) { - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc; - doc.Parse<0>(expression); style::conversion::Error error; - return *style::conversion::convert<style::Filter, JSValue>(doc, error); + return *style::conversion::convertJSON<style::Filter>(expression, error); } static void Parse_Filter(benchmark::State& state) { |