Files
MapLibreParticleLab/benchmark/parse/vector_tile.benchmark.cpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

31 lines
970 B
C++

#include <benchmark/benchmark.h>
#include <mln/tile/vector_mvt_tile_data.hpp>
#include <mln/util/io.hpp>
using namespace mln;
static void Parse_VectorTile(benchmark::State& state) {
auto data = std::make_shared<std::string>(
util::read_file("test/fixtures/api/assets/streets/10-163-395.vector.pbf"));
while (state.KeepRunning()) {
std::size_t length = 0;
VectorMVTTileData tile(data);
for (const auto& name : tile.layerNames()) {
if (auto layer = tile.getLayer(name)) {
const std::size_t count = layer->featureCount();
for (std::size_t i = 0; i < count; i++) {
if (auto feature = layer->getFeature(i)) {
length += feature->getGeometries().size();
length += feature->getProperties().size();
}
}
}
}
(void)length;
}
}
BENCHMARK(Parse_VectorTile);