Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19898 closed enhancement (fixed)

[Patch] Performance improvements for DatasetMerger

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

Description

Sometimes JOSM needs much longer than expected to perform an action, eg. when you have a rather complex relation in the selection and use Update Selection. I wondered what goes on and found that DatasetMerger.merge() is very inefficient when the target dataset contains lots of objects, no matter how many object the source has.
Reason: It creates a list of target nodes which is only needed when the source contains an object that has a negative id.

List<? extends OsmPrimitive> candidates = new ArrayList<>(targetDataSet.getNodes());
...
candidates = new ArrayList<>(targetDataSet.getWays());
...
candidates = new ArrayList<>(targetDataSet.getRelations());

Problem: These lines require repeated iterations over SubclassFilteredCollection instances.

Attachments (2)

19898.patch (3.4 KB ) - added by GerdP 4 years ago.
avoid to materialise unneeded copies of SubclassFilteredCollection
19898.2.patch (5.2 KB ) - added by GerdP 4 years ago.

Download all attachments as: .zip

Change History (9)

by GerdP, 4 years ago

Attachment: 19898.patch added

avoid to materialise unneeded copies of SubclassFilteredCollection

comment:1 by GerdP, 4 years ago

Forget that patch. If we need the copy we need it from the original data.

comment:2 by GerdP, 4 years ago

In 17136/josm:

see #19898: Performance improvements for DatasetMerger
Avoid to avoid to materialise unneeded copies of SubclassFilteredCollection

comment:3 by Don-vip, 4 years ago

Keywords: performance added
Milestone: 20.10

comment:4 by GerdP, 4 years ago

Owner: changed from team to GerdP
Status: newassigned

I've only committed a simple improvement. The copies are still created far too often.

by GerdP, 4 years ago

Attachment: 19898.2.patch added

comment:5 by GerdP, 4 years ago

With this patch the copies are only created when needed, and flow control looks better. With downloaded data this is faster, have to try merges of layers with new data.

comment:6 by GerdP, 4 years ago

Resolution: fixed
Status: assignedclosed

Hmm, to be honest I can't find any case where this patch changes performance compared to the already implemented changes in r17136. So I think we can keep the existing code as well.

comment:7 by Don-vip, 4 years ago

Milestone: 20.1020.11

Milestone renamed

Modify Ticket

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