[geos-commits] [SCM] GEOS branch 3.8 updated. c2a683d19b72d092f11f59e6063dfdf1cb739d9a

git at osgeo.org git at osgeo.org
Thu Jan 16 06:39:37 PST 2020


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, 3.8 has been updated
       via  c2a683d19b72d092f11f59e6063dfdf1cb739d9a (commit)
      from  e6af8cf05a84aea4d95696e6ded88ee9f5a031df (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c2a683d19b72d092f11f59e6063dfdf1cb739d9a
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Nov 27 21:17:07 2019 -0500

    Avoid MonotoneChain self-compare in SimpleMCSweepLineIntersector
    
    This is a hotspot in validity profiling. This commit reduces the runtime
    of GEOSisValid from 3.7s to 2.0s for the 5,489 polygons in the
    HydroBASINS level 5 dataset, and from 610ms to 360ms for the individual
    polygon components of the boundary of Australia in the GADM country
    dataset.
    
    Fixes #1008

diff --git a/NEWS b/NEWS
index b32185d..440d266 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ Changes in 3.8.1
     (#1001, Dan Baston)
   - Avoid assertion failure with MSVC 2017 / 2019 (#1002, Dan Baston)
   - Remove whitespace from end of GEOSversion() output (azhi)
-
+  - Improve performance of GEOSisValid (#1008, Dan Baston)
 
 Changes in 3.8.0
 2019-10-10
diff --git a/src/geomgraph/index/SimpleMCSweepLineIntersector.cpp b/src/geomgraph/index/SimpleMCSweepLineIntersector.cpp
index b635ad7..f5749c9 100644
--- a/src/geomgraph/index/SimpleMCSweepLineIntersector.cpp
+++ b/src/geomgraph/index/SimpleMCSweepLineIntersector.cpp
@@ -143,6 +143,14 @@ SimpleMCSweepLineIntersector::processOverlaps(size_t start, size_t end,
         auto& ev1 = events[i];
         if(ev1->isInsert()) {
             MonotoneChain* mc1 = (MonotoneChain*) ev1->getObject();
+
+            if (mc1 == mc0) {
+                // Don't try to compute intersections between a MonotoneChain
+                // and itself. SegmentIntersector::addIntersections will just
+                // ignore them anyway.
+                continue;
+            }
+
             // don't compare edges in same group
             // null group indicates that edges should be compared
             if(ev0->edgeSet == nullptr || (ev0->edgeSet != ev1->edgeSet)) {

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

Summary of changes:
 NEWS                                                 | 2 +-
 src/geomgraph/index/SimpleMCSweepLineIntersector.cpp | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list