From f380577a6c11f0f077becc46f523ed75ea6720bd Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 24 Sep 2018 17:43:14 +1000 Subject: [PATCH] Micro-optimisation: don't call geos for checking point geometry validity Since a single-point will always be valid --- src/core/geometry/qgsgeometry.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index 32b96e5f7372..a319606387a7 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -2365,6 +2365,12 @@ bool QgsGeometry::isGeosValid() const return false; } + // avoid calling geos for trivial point geometries + if ( QgsWkbTypes::flatType( d->geometry->wkbType() ) == QgsWkbTypes::Point ) + { + return true; + } + QgsGeos geos( d->geometry.get() ); mLastError.clear(); return geos.isValid( &mLastError );