Modify

Opened 7 years ago

Closed 4 years ago

#15170 closed enhancement (wontfix)

[Patch] SimplifyWayAction optimizations.

Reported by: shinigami Owned by: shinigami
Priority: normal Milestone:
Component: Core Version:
Keywords: performance Cc:

Description (last modified by shinigami)

I suppose it is not problem in common use case, but this action is used by OpenData plugin, where it is called for every loaded (sometimes very long) way.

It seems that delNodes and newNodes (in simplifyWay) often contains same data. Problem is that in such case AbstractSet.removeAll is processed as repetitive scanning of given collection and it leads to o(n2) complexity.

Another big slowdown is counting of node frequency in method isRequiredNode, it iterates all way for every node. Simple precounted histogram of nodes makes it much faster.

Attachments (3)

simplifyway.patch (898 bytes ) - added by shinigami 7 years ago.
simplifyway2.patch (4.8 KB ) - added by shinigami 7 years ago.
course.patch (1.1 KB ) - added by shinigami 7 years ago.

Download all attachments as: .zip

Change History (9)

by shinigami, 7 years ago

Attachment: simplifyway.patch added

comment:1 by shinigami, 7 years ago

Description: modified (diff)

by shinigami, 7 years ago

Attachment: simplifyway2.patch added

comment:2 by Don-vip, 7 years ago

Keywords: performance added
Summary: SimplifyWayAction optimizations.[Patch] SimplifyWayAction optimizations.

Thanks, some questions:

  • can you please share the dataset showing the slowdown?
  • how much is is faster?
  • did you test with java 9?

comment:3 by shinigami, 7 years ago

One of sets is http://efele.net/maps/tz/world/tz_world.zip - borders of all timezones.
I measured time of OsmImporter.createLayer, it id ~4x faster now.

Other data I used to test are borders of countries extracted from OSM, one multipolygon for one country.
OsmImporter.createLayer takes about 16s now, did not measure it before, but it was enough to have
a lunch:).

Both were measured with latest jdk8.

by shinigami, 7 years ago

Attachment: course.patch added

comment:4 by shinigami, 7 years ago

One little update yet - two invocations of cos(lat2) extracted to variable.

comment:5 by GerdP, 5 years ago

Owner: changed from team to shinigami
Status: newneedinfo

Please check. I tried your patches with r14469 and found no improvement in performance with tz_world.zip. I assume the changes in r13540 helped already.

comment:6 by Don-vip, 4 years ago

Resolution: wontfix
Status: needinfoclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain shinigami.
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.