diff options
Diffstat (limited to 'benchmark/api/render.benchmark.cpp')
-rw-r--r-- | benchmark/api/render.benchmark.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index d2827ed902..29fa122e55 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -7,7 +7,7 @@ #include <mbgl/renderer/renderer.hpp> #include <mbgl/style/style.hpp> #include <mbgl/style/image.hpp> -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/file_source_options.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> @@ -21,11 +21,9 @@ class RenderBenchmark { public: RenderBenchmark() { NetworkStatus::Set(NetworkStatus::Status::Offline); - fileSource.setAccessToken("foobar"); } util::RunLoop loop; - DefaultFileSource fileSource { "benchmark/fixtures/api/cache.db", "." }; }; static void prepare(Map& map, optional<std::string> json = {}) { @@ -39,9 +37,10 @@ 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 }; + auto fileSourceOptions = FileSourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAccessToken("foobar"); + HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSourceOptions }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, MapOptions().withMapMode(MapMode::Static) }; + MapOptions().withMapMode(MapMode::Static), fileSourceOptions }; prepare(map); while (state.KeepRunning()) { @@ -51,10 +50,11 @@ 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 }; + auto fileSourceOptions = FileSourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAccessToken("foobar"); + HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSourceOptions}; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, MapOptions().withMapMode(MapMode::Static) }; - + MapOptions().withMapMode(MapMode::Static), fileSourceOptions }; + while (state.KeepRunning()) { prepare(map, { "{}" }); frontend.render(map); @@ -65,11 +65,12 @@ static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { static void API_renderStill_recreate_map(::benchmark::State& state) { RenderBenchmark bench; - + auto fileSourceOptions = FileSourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAccessToken("foobar"); + while (state.KeepRunning()) { - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource }; + HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSourceOptions }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, MapOptions().withMapMode(MapMode::Static) }; + MapOptions().withMapMode(MapMode::Static), fileSourceOptions }; prepare(map); frontend.render(map); } |