[geos-commits] [SCM] GEOS branch main-perf-ng created. 54993f10f944dcda91b38378f6d7ea30169c9ea9

git at osgeo.org git at osgeo.org
Wed Aug 14 14:54:35 PDT 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main-perf-ng has been created
        at  54993f10f944dcda91b38378f6d7ea30169c9ea9 (commit)

- Log -----------------------------------------------------------------
commit 54993f10f944dcda91b38378f6d7ea30169c9ea9
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Aug 14 14:53:58 2024 -0700

    Lower overhead associated with zeroLengthLine checks, and inline a few popular methods

diff --git a/include/geos/algorithm/CGAlgorithmsDD.h b/include/geos/algorithm/CGAlgorithmsDD.h
index cfb62aa80..ef251c3ee 100644
--- a/include/geos/algorithm/CGAlgorithmsDD.h
+++ b/include/geos/algorithm/CGAlgorithmsDD.h
@@ -87,7 +87,7 @@ public:
      *
      * Uses an approach due to Jonathan Shewchuk, which is in the public domain.
      */
-    static int orientationIndexFilter(
+    static inline int orientationIndexFilter(
         double pax, double pay,
         double pbx, double pby,
         double pcx, double pcy)
diff --git a/include/geos/operation/relateng/RelateGeometry.h b/include/geos/operation/relateng/RelateGeometry.h
index 3c071d056..bf6b15377 100644
--- a/include/geos/operation/relateng/RelateGeometry.h
+++ b/include/geos/operation/relateng/RelateGeometry.h
@@ -97,6 +97,13 @@ private:
 
     static bool isZeroLength(const LineString* line);
 
+    bool isZeroLengthLine(const Geometry* g) {
+        // avoid expensive zero-length calculation if not linear
+        if (getDimension() != Dimension::L)
+            return false;
+        return isZeroLength(g);
+    };
+
     RelatePointLocator* getLocator();
 
     Coordinate::ConstXYSet createUniquePoints();
diff --git a/include/geos/operation/relateng/TopologyComputer.h b/include/geos/operation/relateng/TopologyComputer.h
index cad2a1bc3..00b204693 100644
--- a/include/geos/operation/relateng/TopologyComputer.h
+++ b/include/geos/operation/relateng/TopologyComputer.h
@@ -67,7 +67,9 @@ private:
 
     void initExteriorEmpty(bool geomNonEmpty);
 
-    RelateGeometry& getGeometry(bool isA) const;
+    inline RelateGeometry& getGeometry(bool isA) const {
+        return isA ? geomA : geomB;
+    };
 
     void updateDim(Location locA, Location locB, int dimension);
 
@@ -135,16 +137,16 @@ private:
 
 public:
 
-        TopologyComputer(
-            TopologyPredicate& p_predicate,
-            RelateGeometry& p_geomA,
-            RelateGeometry& p_geomB)
-            : predicate(p_predicate)
-            , geomA(p_geomA)
-            , geomB(p_geomB)
-            {
-                initExteriorDims();
-            };
+    TopologyComputer(
+        TopologyPredicate& p_predicate,
+        RelateGeometry& p_geomA,
+        RelateGeometry& p_geomB)
+        : predicate(p_predicate)
+        , geomA(p_geomA)
+        , geomB(p_geomB)
+        {
+            initExteriorDims();
+        };
 
     int getDimension(bool isA) const;
 
diff --git a/src/operation/relateng/RelateGeometry.cpp b/src/operation/relateng/RelateGeometry.cpp
index 94536c16e..cb4a93b52 100644
--- a/src/operation/relateng/RelateGeometry.cpp
+++ b/src/operation/relateng/RelateGeometry.cpp
@@ -56,7 +56,7 @@ RelateGeometry::RelateGeometry(const Geometry* input, bool isPrepared, const Bou
     , geomEnv(input->getEnvelopeInternal())
     , boundaryNodeRule(bnRule)
     , geomDim(input->getDimension())
-    , isLineZeroLen(isZeroLength(input))
+    , isLineZeroLen(isZeroLengthLine(input))
     , isGeomEmpty(input->isEmpty())
 {
     analyzeDimensions();
diff --git a/src/operation/relateng/TopologyComputer.cpp b/src/operation/relateng/TopologyComputer.cpp
index 984073e46..fe0c0735e 100644
--- a/src/operation/relateng/TopologyComputer.cpp
+++ b/src/operation/relateng/TopologyComputer.cpp
@@ -111,11 +111,12 @@ TopologyComputer::initExteriorEmpty(bool geomNonEmpty)
 }
 
 
-/* private */
-RelateGeometry&
-TopologyComputer::getGeometry(bool isA) const
+/* public */
+bool
+TopologyComputer::isAreaArea() const
 {
-    return isA ? geomA : geomB;
+    return getDimension(RelateGeometry::GEOM_A) == Dimension::A
+        && getDimension(RelateGeometry::GEOM_B) == Dimension::A;
 }
 
 
@@ -124,16 +125,7 @@ int
 TopologyComputer::getDimension(bool isA) const
 {
     return getGeometry(isA).getDimension();
-}
-
-
-/* public */
-bool
-TopologyComputer::isAreaArea() const
-{
-    return getDimension(RelateGeometry::GEOM_A) == Dimension::A
-        && getDimension(RelateGeometry::GEOM_B) == Dimension::A;
-}
+};
 
 
 /* public */

-----------------------------------------------------------------------


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list