[geos-devel] Upgrading to geos 3.3.0 broke all our codebase !
Sandro Santilli
strk at keybit.net
Fri Jul 8 11:44:48 EDT 2011
On Fri, Jul 08, 2011 at 01:23:05PM +0200, Maxime van Noppen wrote:
> We care a lot about performance. In specific intensive loops this
> might add 0.1 to 3% (wild guess based on previous profiling of the
> code) of overhead.
[...]
> A very-very-simple-and-naive test to have some feedback:
[...]
> int main()
> {
>
> geos::geom::GeometryFactory gf;
> std::list<geos::geom::Point*> point_list;
>
> geos::geom::Coordinate c;
> c.x = 0;
> c.y = 0;
> geos::geom::Geometry* p = gf.createPoint(c);
>
> for (unsigned int i = 0; i < 100000; ++i)
> point_list.push_back(dynamic_cast<geos::geom::Point*>(p));
>
> std::cout << point_list.size() << std::endl;
> }
> ---------------------------------------------------------------
>
> Compiled with g++ -03, this yields these results:
>
> - main() : 100%
> - dynamic_cast : 41%
> - operator new : 31.6%
> - operator delete : 15.2%
>
> This enlightens the cost of dynamic_cast which can really be a big
> hit on such specific and intensive loops.
You're basically noticing here that about 17 calls to malloc + 17
calls to free (34 calls of memory related functions) are taking up
41 + 15.2 = 56.2% of the time while 41% of it is spent doing 100000
dynamic_cast calls.
And this is assuming you sampled enough time to be meaningful...
I guess your average GEOS application does more than that ?
--strk;
() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html
More information about the geos-devel
mailing list