This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Asheem Mamoowala
committed
Feb 21, 2018
1 parent
f8ac3e7
commit 9f6ae2c
Showing
3 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <benchmark/benchmark.h> | ||
#include <mbgl/util/geo.hpp> | ||
#include <mbgl/util/geometry.hpp> | ||
#include <mbgl/util/tile_coordinate.hpp> | ||
#include <mbgl/util/tile_cover.hpp> | ||
|
||
using namespace mbgl; | ||
|
||
static const LatLngBounds sanFrancisco = | ||
LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); | ||
|
||
static void TileCountBounds(benchmark::State& state) { | ||
std::size_t length = 0; | ||
while (state.KeepRunning()) { | ||
auto count = util::tileCount(sanFrancisco, 10); | ||
length += count; | ||
} | ||
} | ||
|
||
static void TileCoverBounds(benchmark::State& state) { | ||
std::size_t length = 0; | ||
while (state.KeepRunning()) { | ||
auto tiles = util::tileCover(sanFrancisco, 10); | ||
length += tiles.size(); | ||
} | ||
} | ||
|
||
static const auto sanFranciscoPolygon = Polygon<double>{ | ||
{ | ||
{-122.5143814086914,37.779127216982424}, | ||
{-122.50811576843262,37.72721239056709}, | ||
{-122.50313758850099,37.70820178063929}, | ||
{-122.3938751220703,37.707454835665274}, | ||
{-122.37567901611328,37.70663997801684}, | ||
{-122.36297607421874,37.71343018466285}, | ||
{-122.354736328125,37.727280276860036}, | ||
{-122.36469268798828,37.73868429065797}, | ||
{-122.38014221191408,37.75442980295571}, | ||
{-122.38391876220702,37.78753873820529}, | ||
{-122.35919952392578,37.8065289741725}, | ||
{-122.35679626464844,37.820632846207864}, | ||
{-122.3712158203125,37.835276322922695}, | ||
{-122.3818588256836,37.82958198283902}, | ||
{-122.37190246582031,37.80788523279169}, | ||
{-122.38735198974608,37.791337175930686}, | ||
{-122.40966796874999,37.812767557570204}, | ||
{-122.46425628662108,37.807071480609274}, | ||
{-122.46803283691405,37.810326435534755}, | ||
{-122.47901916503906,37.81168262440736}, | ||
{-122.48966217041016,37.78916666399649}, | ||
{-122.50579833984375,37.78781006166096}, | ||
{-122.5143814086914,37.779127216982424} | ||
} | ||
}; | ||
|
||
static void TileCoverPolygon(benchmark::State& state) { | ||
std::size_t length = 0; | ||
|
||
while (state.KeepRunning()) { | ||
auto tiles = util::tileCover(sanFranciscoPolygon, 8); | ||
length += tiles.size(); | ||
} | ||
} | ||
|
||
BENCHMARK(TileCountBounds); | ||
BENCHMARK(TileCoverBounds); | ||
BENCHMARK(TileCoverPolygon); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,6 @@ set(MBGL_BENCHMARK_FILES | |
|
||
# util | ||
benchmark/util/dtoa.benchmark.cpp | ||
benchmark/util/tilecover.benchmark.cpp | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters