From 2144e3f3b0b8f08b65c854225d7360847633f689 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 7 Mar 2019 23:24:52 +0200 Subject: [core] Implement platform::Factory::sharedFileSource() --- benchmark/api/render.benchmark.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'benchmark/api/render.benchmark.cpp') 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 #include #include -#include +#include #include #include #include @@ -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 json = {}) { @@ -39,9 +37,10 @@ static void prepare(Map& map, optional 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); } -- cgit v1.2.1