Trac #728 Delaunay triangulation performance problem #55

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@dbaston
dbaston commented Nov 21, 2015

As described in postgis/postgis#73

@dbaston dbaston use std::vector instead of std::list to avoid size() bottleneck
ae2c176
@dbaston dbaston referenced this pull request in postgis/postgis Nov 21, 2015
Closed

ST_Voronoi - trac #2259 #73

@strk
strk commented on ae2c176 Nov 21, 2015

did you check if quadEdges can be at most 4 items ?

@strk
Member
strk commented Nov 21, 2015

interesting enough, there's no testcase triggering a call to that removal method!

@strk
Member
strk commented Nov 21, 2015

Taking it back, the method is called. From the testsuite only once and finds 12 edges.
Better review how many such calls the class may get. To run (and improve) the test:
./geos_unit geos::triangulate::Delaunay

Reviewing internal usage of that container would be another approach, as I'm pretty sure .size() is being called far more than needed.

@dbaston
dbaston commented Nov 21, 2015

From looking on the JTS side, I don't think QuadEdgeSubdivision::remove method is ever called from within the library - it would only ever be accessed if a user is manipulating their own QuadEdgeSubdivision, which would be a fringe use case. Even the comments in JTS (which were copied to GEOS) indicate the performance of the remove method is unimportant:

https://github.com/metteo/jts/blob/master/jts-core/src/main/java/com/vividsolutions/jts/triangulate/quadedge/QuadEdgeSubdivision.java#L230

I think switching the container type is a simple solution that will bring a 10x - 100x performance increase for the core use cases of GEOSDelaunayTriangles and GEOSVoronoiDiagram. It also better matches the JTS implementation, which uses an ArrayList instead of a LinkedList.

@strk
Member
strk commented Nov 21, 2015
@strk strk pushed a commit that referenced this pull request Nov 21, 2015
Sandro Santilli use std::vector instead of std::list to avoid size() bottleneck
Patch by Daniel Baston via
#55

git-svn-id: http://svn.osgeo.org/geos/trunk@4119 5242fede-7e19-0410-aef8-94bd7d2200fb
80a475a
@dbaston
dbaston commented Nov 21, 2015

Thanks! Can this be applied to the 3.5 branch? It would be nice to get the benefit for ST_Voronoi in PostGIS.

@strk
Member
strk commented Nov 21, 2015
@strk strk pushed a commit that referenced this pull request Nov 21, 2015
Sandro Santilli use std::vector instead of std::list to avoid size() bottleneck
Patch by Daniel Baston via
#55

git-svn-id: http://svn.osgeo.org/geos/branches/3.5@4120 5242fede-7e19-0410-aef8-94bd7d2200fb
1287c9d
@dbaston dbaston closed this Nov 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment