[geos-devel] GEOSGetCoordinates() and performance (postgis bug fix)

strk strk at keybit.net
Fri Oct 24 12:36:31 EDT 2003


dblasby wrote:
> strk wrote:
> > The function GEOSGetCoordinates() had a comment on top stating
> > it would have been called just for linestring, so I casted given
> > pointer to a linestring and used getCoordinatesRO() for performance.
> 
> It was orginally only going to be called for linestrings and linearrings 
> (like the comment says).  Then I noticed it does "the right things" for 
> polygons and multipoints.

I was trying to remove unnecessary memory copies and I though we could
call getCoordinatesRO() in PolyFromGeometry. Why call GEOSGetCoordinates
and then make a copy of the whole list ? The list returned by
GEOSGetCoordinates is not needed in the first place and moreover it
might be not in the format suitable for postgis (in the future - who knows?).

Since GEOSGetCoordinates will return a POINT3D array it could detect
he's faced with a Polygon or Line or whatever and use an ad-hoc function
to do the job with less copying possible. What do you think ? Will
Defining functions like GEOSGetCoordinates(Polygon *),
GEOSGetCoordinates(LineString *), etc  work for this ?

Do you think it's worth taking this path ? I'm trying to speedup
unite() aggregate... I'd also like to talk about all those strcmp.

--strk;



More information about the geos-devel mailing list