[postgis-devel] Optimizing contains/within

Charlie Savage cfis at savagexi.com
Mon Jul 23 13:49:47 PDT 2007

Hi Robert,

> I am looking at the geos code for the contains calls for a point in a
> multipolygon, which appears to boil down to the function:
> point_in_ring(POINTARRAY *pts, POINT2D *point)

Have you profiled your program?  If not, then the first step it to 
figure out what is slow.  If you have access to a Linux box then run 
your program under Valgrind (it has a profiler) and it will tell you 
*exactly* what is slow.  In a large code base like GEOS, its almost 
impossible to know where the bottlenecks are by just eyeballing the 
code.  Just because a function is called a million times doesn't 
necessarily make it the bottleneck.

Once you know which function, and which line is slow, then its becomes 
much easier to fix the problem.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20070723/5e686b10/attachment.bin>

More information about the postgis-devel mailing list