summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-09-11 14:16:22 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-09-11 14:56:29 +0300
commitdbe0f706c34852cd18637ba28167731e72712de6 (patch)
tree5069dfe53aa44e8331a45dbc304cbff3c1f64e6b
parent447b6364529abe6672fb33888e5525127d4e6b5c (diff)
downloadqtlocation-mapboxgl-dbe0f706c34852cd18637ba28167731e72712de6.tar.gz
benchmark
-rw-r--r--benchmark/api/query.benchmark.cpp6
-rw-r--r--benchmark/api/render.benchmark.cpp8
-rw-r--r--benchmark/parse/vector_tile.benchmark.cpp4
-rw-r--r--cmake/benchmark.cmake17
4 files changed, 18 insertions, 17 deletions
diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp
index 5e7fd823e0..bc2e269d65 100644
--- a/benchmark/api/query.benchmark.cpp
+++ b/benchmark/api/query.benchmark.cpp
@@ -8,7 +8,7 @@
#include <mbgl/style/image.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/image.hpp>
-#include <mbgl/util/io.hpp>
+#include <mapbox/io.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
@@ -20,10 +20,10 @@ public:
QueryBenchmark() {
NetworkStatus::Set(NetworkStatus::Status::Offline);
- map.getStyle().loadJSON(util::read_file("benchmark/fixtures/api/style.json"));
+ map.getStyle().loadJSON(*mapbox::base::io::readFile("benchmark/fixtures/api/style.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
map.getStyle().addImage(std::make_unique<style::Image>("test-icon",
- decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0));
+ decodeImage(*mapbox::base::io::readFile("benchmark/fixtures/api/default_marker.png")), 1.0));
frontend.render(map);
}
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp
index 305ae8ce79..211af8cb53 100644
--- a/benchmark/api/render.benchmark.cpp
+++ b/benchmark/api/render.benchmark.cpp
@@ -10,7 +10,7 @@
#include <mbgl/storage/resource_options.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/image.hpp>
-#include <mbgl/util/io.hpp>
+#include <mapbox/io.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
@@ -31,10 +31,10 @@ public:
};
static void prepare(Map& map, optional<std::string> json = {}) {
- map.getStyle().loadJSON(json ? *json : util::read_file("benchmark/fixtures/api/style.json"));
+ map.getStyle().loadJSON(json ? *json : *mapbox::base::io::readFile("benchmark/fixtures/api/style.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
- auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png"));
+ auto image = decodeImage(*mapbox::base::io::readFile("benchmark/fixtures/api/default_marker.png"));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0));
}
@@ -59,7 +59,7 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state
Map map { frontend, MapObserver::nullObserver(),
MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") };
- prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json"));
+ prepare(map, *mapbox::base::io::readFile("benchmark/fixtures/api/style_formatted_labels.json"));
while (state.KeepRunning()) {
frontend.render(map);
diff --git a/benchmark/parse/vector_tile.benchmark.cpp b/benchmark/parse/vector_tile.benchmark.cpp
index 24623dbda7..7d60b08a7b 100644
--- a/benchmark/parse/vector_tile.benchmark.cpp
+++ b/benchmark/parse/vector_tile.benchmark.cpp
@@ -1,12 +1,12 @@
#include <benchmark/benchmark.h>
#include <mbgl/tile/vector_tile_data.hpp>
-#include <mbgl/util/io.hpp>
+#include <mapbox/io.hpp>
using namespace mbgl;
static void Parse_VectorTile(benchmark::State& state) {
- auto data = std::make_shared<std::string>(util::read_file("test/fixtures/api/assets/streets/10-163-395.vector.pbf"));
+ auto data = std::make_shared<std::string>(*mapbox::base::io::readFile("test/fixtures/api/assets/streets/10-163-395.vector.pbf"));
while (state.KeepRunning()) {
std::size_t length = 0;
diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake
index a944c64d05..ffe970cb32 100644
--- a/cmake/benchmark.cmake
+++ b/cmake/benchmark.cmake
@@ -2,16 +2,17 @@
load_sources_list(MBGL_BENCHMARK_FILES benchmark/benchmark-files.json)
add_executable(mbgl-benchmark ${MBGL_BENCHMARK_FILES})
-target_include_directories(mbgl-benchmark
- PRIVATE src
- PRIVATE benchmark/include
- PRIVATE benchmark/src
- PRIVATE platform/default/include
+target_include_directories(mbgl-benchmark PRIVATE
+ src
+ benchmark/include
+ benchmark/src
+ platform/default/include
)
-target_link_libraries(mbgl-benchmark
- PRIVATE mbgl-core
- PRIVATE benchmark
+target_link_libraries(mbgl-benchmark PRIVATE
+ mbgl-core
+ benchmark
+ Mapbox::Base::io
)
mbgl_platform_benchmark()