diff options
author | m-stephen <truestyle2005@163.com> | 2019-11-01 10:27:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-01 10:27:03 +0800 |
commit | 9427c04bc709c39f7e083b6d1597aaf33af8c302 (patch) | |
tree | 224fa2bffbc6a81b447c76b98e4c13a51baadc29 /benchmark | |
parent | fc2c02bbc6abaef52077fe5e9e78f772e6009967 (diff) | |
parent | 5b38cfee18800cbb3c6a3186882744592662c3d6 (diff) | |
download | qtlocation-mapboxgl-upstream/stephen-improve-accuracy-for-camera.tar.gz |
Merge branch 'master' into stephen-improve-accuracy-for-cameraupstream/stephen-improve-accuracy-for-camera
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/api/render.benchmark.cpp | 44 | ||||
-rw-r--r-- | benchmark/fixtures/api/cache.db | bin | 1298432 -> 1298432 bytes |
2 files changed, 40 insertions, 4 deletions
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 305ae8ce79..f192e7d3a3 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -1,18 +1,22 @@ #include <benchmark/benchmark.h> +#include <mbgl/gfx/headless_frontend.hpp> #include <mbgl/map/map.hpp> #include <mbgl/map/map_observer.hpp> #include <mbgl/map/map_options.hpp> -#include <mbgl/gfx/headless_frontend.hpp> #include <mbgl/renderer/renderer.hpp> -#include <mbgl/style/style.hpp> -#include <mbgl/style/image.hpp> -#include <mbgl/storage/resource_options.hpp> #include <mbgl/storage/network_status.hpp> +#include <mbgl/storage/resource_options.hpp> +#include <mbgl/style/image.hpp> +#include <mbgl/style/layers/symbol_layer.hpp> +#include <mbgl/style/sources/geojson_source.hpp> +#include <mbgl/style/style.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> #include <mbgl/util/run_loop.hpp> +#include <sstream> + using namespace mbgl; namespace { @@ -94,7 +98,39 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { } } +static void API_renderStill_multiple_sources(::benchmark::State& state) { + using namespace mbgl::style; + RenderBenchmark bench; + HeadlessFrontend frontend{size, pixelRatio}; + Map map{frontend, + MapObserver::nullObserver(), + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), + ResourceOptions().withCachePath(cachePath).withAccessToken("foobar")}; + prepare(map); + auto& style = map.getStyle(); + const int kSourcesCount = 50; + const int kLayersCount = 50; + for (int i = 0; i < kSourcesCount; ++i) { + std::ostringstream sourceOss; + sourceOss << "GeoJSONSource" << i; + std::string sourceId{sourceOss.str()}; + auto source = std::make_unique<GeoJSONSource>(sourceId); + style.addSource(std::move(source)); + for (int j = 0; j < kLayersCount; ++j) { + std::ostringstream layerOss; + layerOss << sourceId << '#' << j; + auto layer = std::make_unique<SymbolLayer>(layerOss.str(), sourceId); + style.addLayer(std::move(layer)); + } + } + + while (state.KeepRunning()) { + frontend.render(map); + } +} + BENCHMARK(API_renderStill_reuse_map); BENCHMARK(API_renderStill_reuse_map_formatted_labels); BENCHMARK(API_renderStill_reuse_map_switch_styles); BENCHMARK(API_renderStill_recreate_map); +BENCHMARK(API_renderStill_multiple_sources); diff --git a/benchmark/fixtures/api/cache.db b/benchmark/fixtures/api/cache.db Binary files differindex fc51eca3b9..64cd376892 100644 --- a/benchmark/fixtures/api/cache.db +++ b/benchmark/fixtures/api/cache.db |