summaryrefslogtreecommitdiff
path: root/benchmark/api/render.benchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/api/render.benchmark.cpp')
-rw-r--r--benchmark/api/render.benchmark.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp
index 90667d4ed4..9f1ea68e0b 100644
--- a/benchmark/api/render.benchmark.cpp
+++ b/benchmark/api/render.benchmark.cpp
@@ -1,14 +1,10 @@
#include <benchmark/benchmark.h>
-#include <mbgl/benchmark/util.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/map/map_observer.hpp>
-#include <mbgl/gl/headless_backend.hpp>
-#include <mbgl/gl/offscreen_view.hpp>
+#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/renderer/renderer.hpp>
-#include <mbgl/renderer/backend_scope.hpp>
-#include <mbgl/renderer/async_renderer_frontend.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -29,9 +25,6 @@ public:
}
util::RunLoop loop;
- HeadlessBackend backend;
- BackendScope scope { backend };
- OffscreenView view { backend.getContext(), { 1000, 1000 } };
DefaultFileSource fileSource { "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool { 4 };
};
@@ -47,25 +40,25 @@ static void prepare(Map& map, optional<std::string> json = {}) {
static void API_renderStill_reuse_map(::benchmark::State& state) {
RenderBenchmark bench;
- AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.backend, bench.view };
- Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
prepare(map);
while (state.KeepRunning()) {
- mbgl::benchmark::render(map, bench.view);
+ frontend.render(map);
}
}
static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {
RenderBenchmark bench;
- AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.backend, bench.view };
- Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
while (state.KeepRunning()) {
prepare(map, { "{}" });
- mbgl::benchmark::render(map, bench.view);
+ frontend.render(map);
prepare(map);
- mbgl::benchmark::render(map, bench.view);
+ frontend.render(map);
}
}
@@ -73,10 +66,10 @@ static void API_renderStill_recreate_map(::benchmark::State& state) {
RenderBenchmark bench;
while (state.KeepRunning()) {
- AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.backend, bench.view };
- Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
prepare(map);
- mbgl::benchmark::render(map, bench.view);
+ frontend.render(map);
}
}