summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorLucas Wojciechowski <lucas@lucaswoj.com>2018-03-08 15:48:08 -0800
committerTobrun <tobrun@mapbox.com>2018-03-09 11:12:14 +0100
commit8a3deab73373c8f3182e4337a3619ebcc58ecc2c (patch)
tree46774560da0eac1e710dccbf41af2f2e7e8794c4 /benchmark
parent6179110b6bfe8ee0880a055a31c12a88f9bd9b20 (diff)
downloadqtlocation-mapboxgl-8a3deab73373c8f3182e4337a3619ebcc58ecc2c.tar.gz
[core] Add expression filter support (#11251)
* WIP * WIP * WIP * Remove Filter::operator()(const Feature&) * WIP * WIP * WIP * WIP * Hook up expression filter evaluator * Replace `shared_ptr` with &reference * Fill in implementation of `void operator()(const ExpressionFilter&)` * Fix failing tests * Switch back to a shared_ptr per chat with @anandthakker * Fix benchmark compilation * Shot in the dark to fix CI * Shot in the dark to fix CI (part 2) * Shot in the dark to fix CI (part 3) * In src/mbgl/style/conversion/filter.cpp, add a port of isExpressionFilter and use it to decide in Converter<Filter>::operator() whether to parse the incoming JSON as an ExpressionFilter or one of the legacy filter types * Remove bool Filter::operator()(const GeometryTileFeature&) const * Ensure the map zoom is passed into filtering operations wherever applicable * Add expression filter tests * Addressed PR feedback * Implement `NSPredicate *operator()(mbgl::style::ExpressionFilter filter)` * Fix formatting& nit
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/fixtures/api/cache.dbbin1298432 -> 1298432 bytes
-rw-r--r--benchmark/parse/filter.benchmark.cpp11
2 files changed, 4 insertions, 7 deletions
diff --git a/benchmark/fixtures/api/cache.db b/benchmark/fixtures/api/cache.db
index 6a1d60421f..10452b2714 100644
--- a/benchmark/fixtures/api/cache.db
+++ b/benchmark/fixtures/api/cache.db
Binary files differ
diff --git a/benchmark/parse/filter.benchmark.cpp b/benchmark/parse/filter.benchmark.cpp
index 4984668400..e4cf635256 100644
--- a/benchmark/parse/filter.benchmark.cpp
+++ b/benchmark/parse/filter.benchmark.cpp
@@ -6,6 +6,7 @@
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/filter.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
+#include <mbgl/benchmark/stub_geometry_tile_feature.hpp>
using namespace mbgl;
@@ -22,15 +23,11 @@ static void Parse_Filter(benchmark::State& state) {
static void Parse_EvaluateFilter(benchmark::State& state) {
const style::Filter filter = parse(R"FILTER(["==", "foo", "bar"])FILTER");
- const PropertyMap properties = { { "foo", std::string("bar") } };
+ const StubGeometryTileFeature feature = { {}, FeatureType::Unknown , {}, {{ "foo", std::string("bar") }} };
+ const style::expression::EvaluationContext context = { &feature };
while (state.KeepRunning()) {
- filter(FeatureType::Unknown, {}, [&] (const std::string& key) -> optional<Value> {
- auto it = properties.find(key);
- if (it == properties.end())
- return {};
- return it->second;
- });
+ filter(context);
}
}