Re: [Jts-topo-suite-user] Perf: Point::isEmpty - no need to allocate lazy Coordinate
Brought to you by:
dr_jts
From: Martin D. <mtn...@gm...> - 2014-11-12 19:00:51
|
Ok, that makes sense. Just wanted to check that was the real issue. On Wed, Nov 12, 2014 at 10:56 AM, Joe Amenta <air...@li...> wrote: > From my understanding, the issue is that, when the coordinate sequence is > something like PackedCoordinateSequence (or really any CoordinateSequence > that doesn't keep Coordinate objects around) and the Point is non-empty > (and there's no cache), the coordinates.getCoordinate(0) call in > Point.getCoordinate() (called from Point.isEmpty()) makes an allocation > that isn't strictly necessary because it could have just checked > coordinates.size() == 0. > > On Wed, Nov 12, 2014 at 1:49 PM, Martin Davis <mtn...@gm...> wrote: > >> Not sure I follow. Don't the new Points already have a coordinate >> allocated? >> >> On Wed, Oct 29, 2014 at 9:05 AM, Janda Martin <ja...@cr...> wrote: >> >>> Hello, >>> >>> Point::isEmpty allocates Coordinate when not already created. >>> >>> I'm using <geometry>.isWithinDistance(<point>, <dist>) for newly created >>> points. Point::isEmpty is called from Point::computeEnvelopeInternal. >>> >>> >>> ORIGINAL CODE: >>> public boolean isEmpty() { >>> return getCoordinate() == null; >>> } >>> >>> SUGGESTED CODE: >>> public boolean isEmpty() { >>> return coordinates.size() == 0; >>> } >>> >>> Martin >>> >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> Jts-topo-suite-user mailing list >>> Jts...@li... >>> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >>> >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk >> _______________________________________________ >> Jts-topo-suite-user mailing list >> Jts...@li... >> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >> >> > |