[geos-devel] Benchmark between various geometry libraries

Maxime van Noppen maxime at altribe.org
Fri Nov 20 12:42:53 EST 2009


strk wrote:
> Thanks for another couple of eyes (see below for comment/fixes).

I've got some bad news. :-)

I looked for any 'new std::something' but I just found there are 'using
namespace std;' in the code, and therefore we should also look for 'new
something'. I found 120 'new vector' out of 656 'new something' :

> yabo at xen ~/dev/geos/trunk $ grep -n 'new vector' `find . -iname '*.cpp'`
> ./doc/example.cpp:297:  vector<Geometry *> *holes = new vector<Geometry *>;
> ./doc/example.cpp:396:  vector<Geometry *> *geoms = new vector<Geometry *>;
> ./doc/example.cpp:450:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:470:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:495:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:880:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:915:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:948:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:981:  newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:1019: newgeoms = new vector<Geometry *>;
> ./doc/example.cpp:1043: newgeoms = new vector<Geometry *>;
> ./tests/bigtest/bug234.cpp:17: vector< Geometry * > *polys1 = new vector<Geometry*>();
> ./tests/bigtest/bug234.cpp:18: vector< Geometry * > *polys2 = new vector<Geometry*>();
> ./tests/bigtest/bug234.cpp:19: vector< Geometry * > *holes1 = new vector<Geometry*>();
> ./tests/bigtest/bug234.cpp:36: polys2->push_back( factory.createPolygon(factory.createLinearRing(coords2), new vector<Geometry*>) );
> ./source/geom/GeometryFactory.cpp:238:          CoordinateSequence *cl=coordinateListFactory->create(new vector<Coordinate>(1, coordinate));
> ./source/geom/GeometryFactory.cpp:288:  vector<Geometry *>*newGeoms = new vector<Geometry *>(fromLines.size());
> ./source/geom/GeometryFactory.cpp:333:  vector<Geometry *> *newGeoms = new vector<Geometry *>(fromGeoms.size());
> ./source/geom/GeometryFactory.cpp:368:  vector<Geometry *>*newGeoms = new vector<Geometry *>(fromPolys.size());
> ./source/geom/GeometryFactory.cpp:429:  vector<Geometry *>*newGeoms = new vector<Geometry *>(fromPoints.size());
> ./source/geom/GeometryFactory.cpp:460:  vector<Geometry *> *pts=new vector<Geometry *>;
> ./source/geom/GeometryFactory.cpp:498:  vector<Geometry *>*newHoles = new vector<Geometry *>(holes.size());
> ./source/geom/Geometry.cpp:567:         vector<Geometry *> *v = new vector<Geometry *>();
> ./source/geom/MultiPolygon.cpp:69:      vector<Geometry *>* allRings=new vector<Geometry *>();
> ./source/geom/Polygon.cpp:59:   holes=new vector<Geometry *>(nholes);
> ./source/geom/Polygon.cpp:87:           holes=new vector<Geometry *>();
> ./source/geom/Polygon.cpp:110:  vector<Coordinate> *cl = new vector<Coordinate>;
> ./source/geom/Polygon.cpp:211:  vector<Geometry *> *rings = new vector<Geometry *>(holes->size()+1);
> ./source/geom/CoordinateArraySequence.cpp:32:   vect(new vector<Coordinate>())
> ./source/geom/CoordinateArraySequence.cpp:37:   vect(new vector<Coordinate>(n))
> ./source/geom/CoordinateArraySequence.cpp:44:   if ( ! vect ) vect = new vector<Coordinate>();
> ./source/geom/CoordinateArraySequence.cpp:51:   vect(new vector<Coordinate>(*(c.vect)))
> ./source/geom/CoordinateArraySequence.cpp:70:   return vect; //new vector<Coordinate>(vect->begin(),vect->end());
> ./source/geom/LineString.cpp:222:       vector<Geometry*> *pts=new vector<Geometry*>();
> ./source/geom/LineSegment.cpp:186:              CoordinateSequence *cl=new CoordinateArraySequence(new vector<Coordinate>(2, intPt));
> ./source/geom/LineSegment.cpp:195:      //vector<Coordinate> *cv = new vector<Coordinate>(2);
> ./source/geom/util/GeometryEditor.cpp:117:      vector<Geometry*> *holes=new vector<Geometry*>;
> ./source/geom/util/GeometryEditor.cpp:141:      vector<Geometry*> *geometries = new vector<Geometry*>();
> ./source/geom/util/GeometryTransformer.cpp:154: vector<Geometry*>* transGeomList = new vector<Geometry*>();
> ./source/geom/util/GeometryTransformer.cpp:227: vector<Geometry*>* transGeomList = new vector<Geometry*>();
> ./source/geom/util/GeometryTransformer.cpp:272: vector<Geometry*>* holes = new vector<Geometry*>();
> ./source/geom/util/GeometryTransformer.cpp:305:         vector<Geometry*>* components = new vector<Geometry*>();
> ./source/geom/util/GeometryTransformer.cpp:331: auto_ptr< vector<Geometry*> > transGeomList( new vector<Geometry*>() );
> ./source/geom/util/GeometryTransformer.cpp:362: vector<Geometry*>* transGeomList = new vector<Geometry*>();
> ./source/geom/CoordinateSequence.cpp:253:       vector<Coordinate> *nv=new vector<Coordinate>;
> ./source/geom/GeometryCollection.cpp:52:        geometries=new vector<Geometry *>(ngeoms);
> ./source/geom/GeometryCollection.cpp:64:                geometries=new vector<Geometry *>();
> ./source/geom/GeometryCollection.cpp:83:        vector<Coordinate> *coordinates = new vector<Coordinate>(getNumPoints());
> ./source/index/quadtree/Quadtree.cpp:129:       vector<void*> *foundItems=new vector<void*>();
> ./source/index/chain/MonotoneChainBuilder.cpp:49:       vector<MonotoneChain*>* mcList = new vector<MonotoneChain*>();
> ./source/index/bintree/NodeBase.cpp:47: items=new vector<void*>();
> ./source/index/bintree/Bintree.cpp:114: vector<void*>* foundItems=new vector<void*>();
> ./source/index/bintree/Bintree.cpp:131: vector<void*>* foundItems=new vector<void*>();
> ./source/index/sweepline/SweepLineIndex.cpp:34: //events=new vector<SweepLineEvent*>();
> ./source/index/strtree/STRtree.cpp:167: vector<BoundableList*>* slices = new vector<BoundableList*>(sliceCount);
> ./source/operation/polygonize/Polygonizer.cpp:232:      polyList=new vector<Polygon*>();
> ./source/operation/polygonize/Polygonizer.cpp:243:      vector<EdgeRing*> *validEdgeRingList=new vector<EdgeRing*>();
> ./source/operation/polygonize/Polygonizer.cpp:244:      invalidRingLines=new vector<LineString*>();
> ./source/operation/polygonize/Polygonizer.cpp:286:      holeList=new vector<EdgeRing*>();
> ./source/operation/polygonize/Polygonizer.cpp:287:      shellList=new vector<EdgeRing*>();
> ./source/operation/polygonize/EdgeRing.cpp:123: deList=new vector<const DirectedEdge*>();
> ./source/operation/polygonize/EdgeRing.cpp:164:         holes=new vector<Geometry*>();
> ./source/operation/overlay/LineBuilder.cpp:57:  //lineEdgesList(new vector<Edge *>()),
> ./source/operation/overlay/LineBuilder.cpp:58:  resultLineList(new vector<LineString *>())
> ./source/operation/overlay/MaximalEdgeRing.cpp:108:     vector<MinimalEdgeRing*> *minEdgeRings=new vector<MinimalEdgeRing*>;
> ./source/operation/overlay/OverlayOp.cpp:624:   vector<Geometry*> *geomList=new vector<Geometry*>();
> ./source/operation/overlay/OverlayOp.cpp:760:   resultPolyList=new vector<Polygon*>(gvsize);
> ./source/operation/overlay/EdgeSetNoder.cpp:52: vector<Edge*> *splitEdges=new vector<Edge*>();
> ./source/operation/overlay/PolygonBuilder.cpp:153:      vector<MaximalEdgeRing*> *maxEdgeRings=new vector<MaximalEdgeRing*>();
> ./source/operation/overlay/PolygonBuilder.cpp:198:      vector<MaximalEdgeRing*> *edgeRings=new vector<MaximalEdgeRing*>();
> ./source/operation/overlay/PolygonBuilder.cpp:386:      vector<Geometry*> *resultPolyList=new vector<Geometry*>();
> ./source/operation/overlay/validate/OffsetPointGenerator.cpp:62:        offsetPts.reset(new vector<Coordinate>());
> ./source/operation/overlay/validate/FuzzyPointLocator.cpp:66:   vector<Geometry*>* lineGeoms = new vector<Geometry*>();
> ./source/operation/overlay/validate/FuzzyPointLocator.cpp:99:   vector<Geometry*>* lineGeoms = new vector<Geometry*>();
> ./source/operation/overlay/validate/OverlayResultValidator.cpp:78:      auto_ptr< vector<Coordinate> > nc ( new vector<Coordinate>(coords) );
> ./source/operation/distance/ConnectedElementLocationFilter.cpp:42:      vector<GeometryLocation*> *loc=new vector<GeometryLocation*>();
> ./source/operation/distance/DistanceOp.cpp:229: minDistanceLocation = new vector<GeometryLocation*>(2);
> ./source/operation/distance/DistanceOp.cpp:263: vector<GeometryLocation*> *locPtPoly = new vector<GeometryLocation*>(2);
> ./source/operation/distance/ConnectedElementPointFilter.cpp:44: vector<const Coordinate*> *points=new vector<const Coordinate*>();
> ./source/operation/linemerge/EdgeString.cpp:45: directedEdges(new vector<LineMergeDirectedEdge*>()),
> ./source/operation/linemerge/LineMerger.cpp:120:        mergedLineStrings=new vector<LineString*>(numEdgeStrings);
> ./source/operation/relate/EdgeEndBundle.cpp:44: edgeEnds=new vector<EdgeEnd*>();
> ./source/operation/relate/EdgeEndBuilder.cpp:41:        vector<EdgeEnd*> *l=new vector<EdgeEnd*>();
> ./source/io/WKBReader.cpp:354:                  holes = new vector<Geometry *>(numRings-1);
> ./source/io/WKBReader.cpp:372:  vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms);
> ./source/io/WKBReader.cpp:399:  vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms);
> ./source/io/WKBReader.cpp:426:  vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms);
> ./source/io/WKBReader.cpp:453:  vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms);
> ./source/io/WKTReader.cpp:285:          vector<Geometry *> *points=new vector<Geometry *>();
> ./source/io/WKTReader.cpp:349:  vector<Geometry *> *holes=new vector<Geometry *>();
> ./source/io/WKTReader.cpp:374:  vector<Geometry *> *lineStrings=new vector<Geometry *>();
> ./source/io/WKTReader.cpp:394:  vector<Geometry *> *polygons=new vector<Geometry *>();
> ./source/io/WKTReader.cpp:414:  vector<Geometry *> *geoms=new vector<Geometry *>();
> ./source/simplify/LineSegmentIndex.cpp:66:              items(new vector<LineSegment*>())
> ./source/simplify/LineSegmentIndex.cpp:78:              items(new vector<LineSegment*>(*(o.items.get())))
> ./source/simplify/LineSegmentIndex.cpp:86:              items.reset(new vector<LineSegment*>(*(o.items.get())));
> ./source/geomgraph/index/SimpleSweepLineIntersector.cpp:34:     //events(new vector<SweepLineEvent*>()),
> ./source/geomgraph/index/SimpleMCSweepLineIntersector.cpp:33:   //events(new vector<SweepLineEvent*>())
> ./source/geomgraph/index/MonotoneChainIndexer.cpp:38:   //vector<int>* startIndexList=new vector<int>();
> ./source/geomgraph/PlanarGraph.cpp:78:  edges(new vector<Edge*>()),
> ./source/geomgraph/PlanarGraph.cpp:80:  edgeEndList(new vector<EdgeEnd*>())
> ./source/geomgraph/PlanarGraph.cpp:87:  edges(new vector<Edge*>()),
> ./source/geomgraph/PlanarGraph.cpp:89:  edgeEndList(new vector<EdgeEnd*>())
> ./source/geomgraph/EdgeRing.cpp:184:    vector<Geometry *> *holeLR=new vector<Geometry *>(nholes);
> ./source/geomgraph/TopologyLocation.cpp:72:     //location=new vector<int>(gl->location->begin(),gl->location->end());
> ./source/geomgraph/EdgeIntersectionList.cpp:153:        vector<Coordinate> *vc=new vector<Coordinate>();
> ./source/geomgraph/GeometryGraph.cpp:118:               boundaryNodes.reset(new vector<Node*>());
> ./source/algorithm/ConvexHull.cpp:335://        vector<Coordinate> *ps=new vector<Coordinate>();
> ./source/algorithm/ConvexHull.cpp:517://        vector<Coordinate> *newPts=new vector<Coordinate>;
> ./source/algorithm/InteriorPointArea.cpp:145:   vector<Coordinate>*cv=new vector<Coordinate>(2);
> ./source/examples/CustomPointCoordinateSequence.cpp:78: vector<Coordinate>* v=new vector<Coordinate>();
> ./source/examples/CustomPointCoordinateSequence.cpp:86: vector<point_3d>* v=new vector<point_3d>();
> ./source/util/GeometricShapeFactory.cpp:102:    vector<Coordinate> *vc = new vector<Coordinate>(4*nSide+1);
> ./source/util/GeometricShapeFactory.cpp:143:    vector<Coordinate>*pts=new vector<Coordinate>(nPts+1);
> ./source/util/GeometricShapeFactory.cpp:174:    vector<Coordinate> *pts = new vector<Coordinate>(nPts);
> ./source/util/GeometricShapeFactory.cpp:203:    vector<Coordinate> *pts = new vector<Coordinate>(nPts + 2);
> ./source/precision/SimpleGeometryPrecisionReducer.cpp:74:       vector<Coordinate> *vc = new vector<Coordinate>(csSize);
> ./source/planargraph/DirectedEdge.cpp:46:       vector<Edge*> *edges=new vector<Edge*>();
> ./source/planargraph/PlanarGraph.cpp:128:       vector<Node*> *nodesFound=new vector<Node*>();
> ./source/planargraph/NodeMap.cpp:70:    vector<Node*> *values=new vector<Node*>();

-- 
Maxime


More information about the geos-devel mailing list