[core] Add batch conversion of latLngs to/from screenCoords (#15891)

* [core] Add batch conversion of latLng vs screenCoord

* [core] Take the simple approach
This commit is contained in:
zmiao
2019-11-07 18:16:31 +02:00
committed by GitHub
parent 1d49c23b85
commit 2e8a350d68
5 changed files with 101 additions and 15 deletions

View File

@@ -38,6 +38,30 @@ public:
} // end namespace
static void API_queryPixelsForLatLngs(::benchmark::State& state) {
std::vector<LatLng> points;
int count = 10000;
for (int i = 0; i < count; ++i) {
points.emplace_back(1, 1);
}
QueryBenchmark bench;
while (state.KeepRunning()) {
(void)bench.map.pixelsForLatLngs(points);
}
}
static void API_queryLatLngsForPixels(::benchmark::State& state) {
std::vector<ScreenCoordinate> points;
int count = 10000;
for (int i = 0; i < count; ++i) {
points.emplace_back(1, 1);
}
QueryBenchmark bench;
while (state.KeepRunning()) {
(void)bench.map.latLngsForPixels(points);
}
}
static void API_queryRenderedFeaturesAll(::benchmark::State& state) {
QueryBenchmark bench;
@@ -61,7 +85,8 @@ static void API_queryRenderedFeaturesLayerFromHighDensity(::benchmark::State& st
bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {{{"road-street" }}, {}});
}
}
BENCHMARK(API_queryPixelsForLatLngs);
BENCHMARK(API_queryLatLngsForPixels);
BENCHMARK(API_queryRenderedFeaturesAll);
BENCHMARK(API_queryRenderedFeaturesLayerFromLowDensity);
BENCHMARK(API_queryRenderedFeaturesLayerFromHighDensity);