#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)
Change History (9)
by , 4 years ago
Attachment: | 19898.patch added |
---|
comment:1 by , 4 years ago
Forget that patch. If we need the copy we need it from the original data.
comment:3 by , 4 years ago
Keywords: | performance added |
---|---|
Milestone: | → 20.10 |
comment:4 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I've only committed a simple improvement. The copies are still created far too often.
by , 4 years ago
Attachment: | 19898.2.patch added |
---|
comment:5 by , 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 , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.
avoid to materialise unneeded copies of
SubclassFilteredCollection