Modify

Opened 23 months ago

Closed 23 months ago

Last modified 22 months ago

#22115 closed defect (fixed)

[PATCH][RFC] Extract methods from LatLon into ILatLon where they are generally applicable

Reported by: taylor.smock Owned by: team
Priority: normal Milestone: 22.06
Component: Core Version:
Keywords: performance Cc:

Description (last modified by taylor.smock)

The attached patch does the following:

  • Moves greatCircleDistance and bearing into ILatLon from LatLon
  • Where possible, remove getCoor() calls and instead call the appropriate method directly
  • Deprecates the original methods (rather unfortunately, this does mean we will have deprecation warnings when compiling for a bit, as most of the remaining calls deal with EastNorth conversions)
  • Where possible (when noticed), if something calls Node#getCoor and then directly passes the result into something that accepts ILatLon, the Node is now passed instead.

This does not move interpolate and getCenter, as both return a LatLon.

For those reading the code, Node extends INode which extends ILatLon.

This should decrease overall memory allocations significantly. One major win is in SearchCompiler#match, where a Bounds#contains(LatLon) is replaced by Bounds#contains(ILatLon), where the ILatLon is the Node (in a validation test of Mesa County, Colorado, the getCoor call accounted for 284 MiB of 2.216 GiB memory allocations for SearchCompiler#Match).

Note: I'm not sold on the @deprecation annotations. I'd like to be able to remove the methods from LatLon someday, but those methods are used a lot, so there will be a lot of breakage when we do remove them.

Profiling results (again, Mesa County Colorado nwr in "Mesa County, Colorado"):

  • Node#getCoor (using method back traces) went from 501 MiB to 97 MiB.
  • SearchCompiler.InArea#Match went from 2.216 GiB to 2 GiB, which is about right.

Attachments (1)

22115.patch (30.4 KB ) - added by taylor.smock 23 months ago.

Download all attachments as: .zip

Change History (23)

by taylor.smock, 23 months ago

Attachment: 22115.patch added

comment:1 by taylor.smock, 23 months ago

Description: modified (diff)
Milestone: 22.06
Summary: [PATCH] Extract methods from LatLon into ILatLon where they are generally applicable[PATCH][RFC] Extract methods from LatLon into ILatLon where they are generally applicable

comment:2 by taylor.smock, 23 months ago

Description: modified (diff)

comment:3 by taylor.smock, 23 months ago

Resolution: fixed
Status: newclosed

In 18494/josm:

Fix #22115: Extract methods from LatLon into ILatLon where they are generally applicable

This also removes calls to Node#getCoor where possible, which reduces
the number of memory allocations in SearchCompiler#match, and overall
allocations due to Node#getCoor

comment:4 by taylor.smock, 23 months ago

In 35978/osm:

See #22115: Extract methods from LatLon into ILatLon where they are generally applicable

This uses the extracted methods where possible, and removes unnecessary
Node#getCoor calls.

comment:5 by taylor.smock, 23 months ago

In 35979/osm:

See #22115 (dist): Extract methods from LatLon into ILatLon where they are generally applicable

This uses the extracted methods where possible, and removes unnecessary
Node#getCoor calls.

comment:6 by GerdP, 23 months ago

see #22146 for a regression when old JOSM jar is used with new plugin jar. Not sure which other modules are involved.

comment:7 by taylor.smock, 23 months ago

Looks like I failed to update the plugin mainversion value for it. I'll see if I can revert r35978/osm for utilsplugin2. I believe I got the build.xml for everything else updated.

comment:8 by GerdP, 23 months ago

Yes, it's an errorprone process ...

comment:9 by GerdP, 23 months ago

I think you just have to revert the dist, then fix the problem and dist again?

in reply to:  9 comment:10 by taylor.smock, 23 months ago

Replying to GerdP:

I think you just have to revert the dist, then fix the problem and dist again?

Maybe? I'd have to ask stoecker/Don-vip. I'm going to go for the surefire way (AKA revert, build, commit dist, etc.)

comment:11 by GerdP, 23 months ago

Better, yes. Else old JOSM would not update in #22146

comment:12 by taylor.smock, 23 months ago

In 35988/osm:

See #22146, #22115: build.xml for utilsplugin2 was not updated (part 2)

This was part of r35978/osm (LatLon -> ILatLon).

comment:13 by taylor.smock, 23 months ago

In 35989/osm:

See #22146, #22115 (dist): build.xml for utilsplugin2 was not updated (part 2)

This was part of r35978/osm (LatLon -> ILatLon).

comment:14 by GerdP, 23 months ago

another regression in #22149 .. #22151

comment:15 by anonymous, 23 months ago

I'll see if I can fix it. Minimum 60 minutes though.

comment:16 by skyper, 23 months ago

Besides photoadjust, following plugins need to be checked, too:

  • building_tools
  • indoor_sweepline
  • livegps
  • pbf
  • tracer

comment:17 by taylor.smock, 23 months ago

In 35991/osm:

Fix #22149, see #22115 (dist)

comment:18 by taylor.smock, 23 months ago

In 35992/osm:

See #22115, #22149: Update build.xml for r18494 and r35978/osm

in reply to:  16 comment:19 by taylor.smock, 22 months ago

Replying to skyper:

  • building_tools

Should be fine. The only real change was internal to the plugin (latlon2eastNorth). EDIT: See r35756/osm

  • indoor_sweepline

Same as buildings_tools. EDIT: Compiles with r18464. Should be fine.

  • livegps

r35975/osm increased it to 18464. EDIT: Doesn't seem to be released via svn.

  • pbf

Should be fine. It was getCoor + lat/lon calls.

  • tracer

r35975/osm increased it to 18464. EDIT: Compiles with r18464. Should be fine.

I'll double check. It doesn't help that 18464 != 18494.

Last edited 22 months ago by taylor.smock (previous) (diff)

comment:20 by skyper, 22 months ago

Thanks Taylor and sorry for the noise.

comment:21 by taylor.smock, 22 months ago

In 35993/osm:

See #22115: Increase min JOSM version

in reply to:  20 comment:22 by taylor.smock, 22 months ago

Replying to skyper:

Thanks Taylor and sorry for the noise.

No worries. I thought I checked all of them using a for loop to compile. I should have just increased the min JOSM version for all of them.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.