Opened 5 years ago
Closed 5 years ago
#18728 closed enhancement (fixed)
[patch WIP] Join overlapping Areas is slow when combining many complex ways
Reported by: | GerdP | Owned by: | GerdP |
---|---|---|---|
Priority: | normal | Milestone: | 20.02 |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
Load sample file join.osm.bz2 from #9911, select all elements and press Shift+J to "Join overlapping Areas"
Note that it takes several seconds to join the areas, on my machine ~12 secs.
One reason for this is that class DeleteCommand
calculates a Hashset for thounsands of objects within a loop instead of doing this once outside of the loop. This takes ~ 60% of the complete time.
Attachments (4)
Change History (12)
by , 5 years ago
Attachment: | 18728.patch added |
---|
comment:1 by , 5 years ago
by , 5 years ago
Attachment: | 18728.2.patch added |
---|
comment:3 by , 5 years ago
The patch 18728.2.patch changes the logic when splitting ways so that only one SequenceCommand is added to undo/redo stack instead of many single SplitWayCommand
instances.
This is a bit faster as it avoids to undo/redo the actions to combine them in one command.
More important: If the undo stack contains many (close to undo.max
) commands it is less likely that the various temporay added commands remove anything from the stack before they are all undone again.
I think with a small value in undo.max
the undo/redo logic is risky, esp. the one which catches the UserCancelException
.
JoinAreasAction assumes that all tempoary added actions are on the stack when performing makeCommitsOneAction()
There are more places in the code where this might be done. Working on it...
by , 5 years ago
Attachment: | 18728.3.patch added |
---|
comment:4 by , 5 years ago
18728.3.patch replaces 18728.2.patch and is a much better solution. It builds an internal undo stack and uses the same improvements as the ValidatorDialog
when e.g. fixing thousands of duplicated nodes.
Unless all actions are done, nothing is added to the UndoRedoHandler.
This also allows to avoid the dirty trick when a UserCancelException
is thrown.
by , 5 years ago
Attachment: | 18728.4.patch added |
---|
comment:5 by , 5 years ago
Milestone: | → 20.02 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
18728.4.patch also improves handling of "Join areas internal error.". Data changes are reverted before the crash report is produced. I think the old code simply never worked, it left all the commands on the undo stack. I am not sure what to do with the
throw new IllegalArgumentException("Way not circular");
Should I also catch this one or change it to
throw new JosmRuntimeException("Join areas internal error.");
or should I add a new class JoinAreaException
and try to write different texts for the different places where it is thrown?
comment:8 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Yes, I thought about another change but it didn't improve performance.
In 15874/josm: