[geos-devel] Benchmark between various geometry libraries

strk strk at keybit.net
Thu Nov 19 16:32:07 EST 2009


On Thu, Nov 19, 2009 at 05:16:53PM +0100, Maxime van Noppen wrote:

> > ~/dev/geos/trunk $ grep 'new std' `find . -iname '*.cpp'`

Thanks for another couple of eyes (see below for comment/fixes).

> > ./capi/geos_ts_c.cpp:        std::vector<Geometry*>* vgeoms = new std::vector<Geometry*>(geoms, geoms + ngeoms);
[...]
> > ./capi/geos_ts_c.cpp:        std::vector<Geometry *> *vholes = new std::vector<Geometry *>(holes, holes + nholes);

The above are heap-allocated to transfer their ownership to the collection
constructed with them. Should be auto_ptr for clarity and exception safety
(GeometryFactory interface needs to be extended to allow that).

> > ./tests/unit/geom/CoordinateListTest.cpp:               std::auto_ptr< std::vector<Coordinate> > col( new std::vector<Coordinate>() );
[...]
> > ./tests/xmltester/XMLTester.cpp:                        std::vector<geom::Geometry *>*newgeoms = new std::vector<geom::Geometry *>(lines->begin(),

Tests, not much important.

> > ./source/index/strtree/AbstractNode.cpp:        childBoundables=new std::vector<Boundable*>();

Fixed by http://trac.osgeo.org/geos/changeset/2724

> > ./source/operation/polygonize/PolygonizeGraph.cpp:                              intNodes=new std::vector<Node*>();

Fixed by http://trac.osgeo.org/geos/changeset/2725

> > ./source/operation/polygonize/PolygonizeGraph.cpp:      std::vector<EdgeRing*> *edgeRingList=new std::vector<EdgeRing*>();

Fixed by http://trac.osgeo.org/geos/changeset/2726
(this is a C++ API change but of an "internal" class)

> > ./source/operation/polygonize/PolygonizeGraph.cpp:      std::vector<PolygonizeDirectedEdge*> *edgeRingStarts=new std::vector<PolygonizeDirectedEdge*>();

Fixed by http://trac.osgeo.org/geos/changeset/2727

> > ./source/operation/polygonize/PolygonizeGraph.cpp:      std::vector<const LineString*> *cutLines=new std::vector<const LineString*>();

Fixed by http://trac.osgeo.org/geos/changeset/2728
... just moving the heap allocation closer to the surface,
will need a second pass ...

> > ./source/operation/polygonize/PolygonizeGraph.cpp:      std::vector<DirectedEdge*> *edges=new std::vector<DirectedEdge*>();

Fixed by http://trac.osgeo.org/geos/changeset/2729

> > ./source/operation/polygonize/PolygonizeGraph.cpp:      std::vector<const LineString*> *dangleLines=new std::vector<const LineString*>();

Fixed by http://trac.osgeo.org/geos/changeset/2730
... just moving the heap allocation closer to the surface,
will need a second pass ...

> > ./source/operation/buffer/BufferBuilder.cpp:      new std::vector< Geometry * >();
> > ./source/operation/buffer/BufferBuilder.cpp:   std::vector< Geometry* >* mergedLinesGeom = new std::vector< Geometry* >();

Constructive again, should be auto_ptr when GeometryFactory is ready


> > ./source/operation/valid/ConnectedInteriorTester.cpp:   std::vector<EdgeRing*> *edgeRings=new std::vector<EdgeRing*>();

Fixed by http://trac.osgeo.org/geos/changeset/2731

> > ./source/geomgraph/DirectedEdgeStar.cpp:        resultAreaEdgeList=new std::vector<DirectedEdge*>();

This is for lazy creation, will only be called once per instance,
could be changed by adding a flag to remember whether processing
happened already, but I don't think it will change things much.

> > ./source/noding/MCIndexSegmentSetMutualIntersector.cpp::        monoChains( new std::vector<index::chain::MonotoneChain *>()),

Fixed by http://trac.osgeo.org/geos/changeset/2732

> > ./source/planargraph/Node.cpp:  std::vector<Edge*>* commonEdges = new std::vector<Edge*>();

This is in a method marked as UNUSED

--strk;

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple! 


More information about the geos-devel mailing list