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

strk strk at keybit.net
Fri Oct 24 17:42:49 EDT 2003


dblasby wrote:
> Whenever I call the getCoordinates() function, I immediately make a copy 
> of the list by converting it from the GEOS coordinates to PostGIS POINT3Ds.
> 
> So, feel free to have all the Postgis GetCoordinates() access read-only 
> version.

I've made a specialized POINT3D-array-from-Polygon function using read-only
direct access to internal Polygon's LinearRings. Speed up is to evaluate
but personally I can not really appreciate it...

> UNIT probably spending a lot of time building Postgis and GEOS geometries.
>
> 1. start with 2 input postgis geometrys
> 2. convert them to GEOS (O(n) where n=# of subcomponents)
> 3. run union
> 4. convert back to postgis (O(n) where n=# of subcomponents)
> 5. start again at step #1
>
> As you can see there possibly O(n^2) constructions (and certainly O(n^2)
> point copies).
>
> If you take an input dataset of disjoint polygons, you'll see this is
> O(n^2) in terms of geometry convertions and copying.

Do you think defining an ad-hoc postgresql type will give it a burst ?

--strk;



More information about the geos-devel mailing list