Hi,

  I suggest to use double-checked locking in PreparedPolygon instead of 
synchronized keyword. It shows increased CPU utilization on multi-core CPU when 
testing 'contains'.

Another possibility is to cache instance of PreparedPolygonContains and 
PreparedPolygonIntersects.

Martin


public class PreparedPolygon
...
        private volatile FastSegmentSetIntersectionFinder segIntFinder = null;
        private volatile PointOnGeometryLocator pia = null;
...

  public FastSegmentSetIntersectionFinder getIntersectionFinder()
  {
        /**
         * MD - Another option would be to use a simple scan for 
         * segment testing for small geometries.  
         * However, testing indicates that there is no particular advantage 
         * to this approach.
         */
        if (segIntFinder == null) {
      synchronized (this) {
        if (segIntFinder == null) 
          segIntFinder = new 
FastSegmentSetIntersectionFinder(SegmentStringUtil.extractSegmentStrings(getGeometry()));
      }
    }
        return segIntFinder;
  }
  
  public PointOnGeometryLocator getPointLocator()
  {
        if (pia == null) {
      synchronized (this) {
        if (pia == null)
          pia = new IndexedPointInAreaLocator(getGeometry());
      }
    }
    return pia;
  }


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to