summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-07-05 15:38:50 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-07-24 12:10:45 +0200
commit4dff51719b27988fe4672bd4022d305b6e7d9816 (patch)
tree3763369ac44f060ca03a4e008431e4725580c137 /benchmark
parent541712aac7433856811e2c24dff583333aabd3c8 (diff)
downloadqtlocation-mapboxgl-4dff51719b27988fe4672bd4022d305b6e7d9816.tar.gz
[core] add algorithm for computing masks for raster tiles
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/parse/tile_mask.benchmark.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/benchmark/parse/tile_mask.benchmark.cpp b/benchmark/parse/tile_mask.benchmark.cpp
new file mode 100644
index 0000000000..79ab685c28
--- /dev/null
+++ b/benchmark/parse/tile_mask.benchmark.cpp
@@ -0,0 +1,38 @@
+#include <benchmark/benchmark.h>
+
+#include <mbgl/algorithm/update_tile_masks.hpp>
+
+using namespace mbgl;
+
+class MaskedRenderable {
+public:
+ MaskedRenderable(const UnwrappedTileID& id_, TileMask&& mask_)
+ : id(id_), mask(std::move(mask_)) {
+ }
+
+ UnwrappedTileID id;
+ TileMask mask;
+ bool used = true;
+
+ void setMask(TileMask&& mask_) {
+ mask = std::move(mask_);
+ }
+};
+
+static void TileMaskGeneration(benchmark::State& state) {
+ std::vector<MaskedRenderable> renderables = {
+ MaskedRenderable{ UnwrappedTileID{ 12, 1028, 1456 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 13, 2056, 2912 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 13, 2056, 2913 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 14, 4112, 5824 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 14, 4112, 5827 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 14, 4114, 5824 }, {} },
+ MaskedRenderable{ UnwrappedTileID{ 14, 4114, 5825 }, {} },
+ };
+
+ while (state.KeepRunning()) {
+ algorithm::updateTileMasks<MaskedRenderable>({ renderables.begin(), renderables.end() });
+ }
+}
+
+BENCHMARK(TileMaskGeneration);