Don Meltz initiated a fascinating flurry of performance evaluation with his post on Is QGIS a Viable Alternative to ArcGIS? and its followup ArcGIS vs QGIS Clipping Contest Rematch. He looked at a spatial processing task involving clipping a large dataset of contour lines against a fairly simple polygon. His conclusion was that QGIS was a lot faster than ArcGIS at performing this task. His final testing produced a time of 6 min 27 sec for QGIS, versus a time of 1 h 35 min for ArcGIS - and which failed with a topology error! (Note: subsequently ESRI reported that they have improved their algorithm to provide much better results for this case - and presumably to enable it to actually complete!).
This inspired a lot of other people to dive in and run the same test (since Don helpfully provided the test data here). Systems tested include many commercial (ArcGIS, GlobalMapper, Manifold) and FOSS systems (QGIS, PostGIS, SpatialLite, GRASS, OGR, uDig, OpenJUMP, etc). There's a summary of some of the timing results here (and the many comments to these posts provide lots of different timings on various software and hardware configurations).
On the Java side, Andrea Antonello of jGrass provides an in-depth description of his optimized implementation using uDig, GeoTools and JTS here. His best result was about 80 sec, using 4 cores and including data I/O. (He later tested on Amazon AWS using 32 cores, giving a 25 sec time).
The SpatialLite wiki has a nice page showing how this problem is tackled in SQL here. It also has an excellent analysis of what this contest actually demonstrates. The key conclusion is that almost all the open source systems are using JTS or GEOS, so what is really being measured is the effectiveness of the JTS overlay algorithm.
The one exception is GRASS, which uses a completely different topological algorithm. From the results the performance of this seems similar to or only a bit slower than JTS/GEOS. This is actually quite impressive since it sounds like the algorithm is computing full topology of the data. But it's hard to know without a more detailed understanding of how it works. And in any case, comparing the contest timings is difficult since many different hardware configurations were used.
One aspect of this task is that it is "pleasantly parallel", so implementations which can multi-thread over many cores should see linear performance improvement. Only some of the systems tested were able to take advantage of this. In particular, PostGIS and SpatialLite execute single queries in a sequential fashion, which is a shame. Perhaps this will be rectified in future releases?
It's great to see JTS and GEOS used effectively in so many different applications, and that they hold their own against the well-funded competition (and in fact often doing much better).
And here's the kicker - it could run even faster! The JTS overlay algorithm was designed for the single geometry/geometry case. It has not been optimized for iterated operations against a fixed query geometry. By using a caching approach similar to the existing JTS PreparedGeometry API, it will be possible to avoid recomputing polygon topology and thus provide a significant speedup. Also, the overlay algorithm was designed to handle all geometry types, and in particular the polygon/polygon case, which is the most demanding situation. It could be optimized to handle simpler cases (such as the polygon/line overlay of this task) in a faster way. All it will take is some time, money, and some hard thinking...
1 month ago