When parsing a polygon, we always validate the geometries, like checking whether it's self-intersected among other sanity checks. (S2 already has optimizations for this rather than using the naive O(n^2) algorithm). The dependency graph given by CPU profiling shows this validation takes 80% of the running time for polygons with thousands vertices. If there is already an index on the geo field, this validation is guaranteed by the index, so we can skip it for stored geometries.
- depends on
-
SERVER-19097 New geo index version for geo performance improvement
- Closed
- related to
-
SERVER-57938 Skip polygon validation for stored GeoJSON when query has $geoIntersect and a 2dsphere index
- Closed