summaryrefslogtreecommitdiff
path: root/benchmark/parse/tile_mask.benchmark.cpp
blob: a31e0b5eab696adda827406a9561bd6a1a7f0c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <benchmark/benchmark.h>

#include <mbgl/algorithm/update_tile_masks.hpp>

using namespace mbgl;

class FakeTile {
public:
    FakeTile(TileMask mask_)
        : mask(std::move(mask_)) {
    }
    void setMask(TileMask mask_) {
        mask = std::move(mask_);
    }

    const bool usedByRenderedLayers = true;
    TileMask mask;
};

static void TileMaskGeneration(benchmark::State& state) {
    std::map<UnwrappedTileID, FakeTile> renderables = {
        { UnwrappedTileID{ 12, 1028, 1456 }, TileMask{} },
        { UnwrappedTileID{ 13, 2056, 2912 }, TileMask{} },
        { UnwrappedTileID{ 13, 2056, 2913 }, TileMask{} },
        { UnwrappedTileID{ 14, 4112, 5824 }, TileMask{} },
        { UnwrappedTileID{ 14, 4112, 5827 }, TileMask{} },
        { UnwrappedTileID{ 14, 4114, 5824 }, TileMask{} },
        { UnwrappedTileID{ 14, 4114, 5825 }, TileMask{} },
    };

    while (state.KeepRunning()) {
        algorithm::updateTileMasks(renderables);
    }
}

BENCHMARK(TileMaskGeneration);