[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user