#16942 closed enhancement (fixed)
[Patch] Poor performance in validator hang when checking complex Multipolygon
Reported by: | GerdP | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 18.11 |
Component: | Core validator | Version: | |
Keywords: | template_report performance | Cc: | ris |
Description
What steps will reproduce the problem?
- Download relation 7379046 (attached as sample file)
- Run validator
What is the expected result?
Quick result that MP is ok with informational messages that it has lots of shared segments
What happens instead?
Dialog shows popup "Starting Multipolygon" for > 6 minutes.
Please provide any additional information below. Attach a screenshot if possible.
VisualVM shows that the lines
sharedByPolygons.retainAll(pd1.getNodes());
sharedByPolygons.retainAll(pd2.getNodes());
in org.openstreetmap.josm.data.validation.tests.MultipolygonTest.checkPolygonsForSharedNodes()
is the problem. These calls are slow when the polygon has many shared segments.
The attached patch improves performance because it avoids the complex routine for many polygon rings.
The check is done within a few seconds now.
There is still room for improvements, it should be possibe to fill a map so that the retainAll calls are no longer needed.
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2018-10-28 22:27:31 +0100 (Sun, 28 Oct 2018) Build-Date:2018-10-28 21:33:32 Revision:14382 Relative:URL: ^/trunk Identification: JOSM/1.5 (14382 en) Windows 10 64-Bit OS Build number: Windows 10 Home 1803 (17134) Memory Usage: 2818 MB / 5461 MB (2088 MB allocated, but free) Java version: 1.8.0_191-b12, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Screen: \Display0 1920x1080 Maximum Screen Size: 1920x1080 Dataset consistency test: No problems found Plugins: + OpeningHoursEditor (34535) + apache-commons (34506) + buildings_tools (34572) + download_along (34503) + ejml (34389) + geotools (34513) + jaxb (34506) + jts (34524) + measurement (34529) + merge-overlap (34664) + o5m (34405) + opendata (34698) + pbf (34576) + poly (34546) + reverter (34552) + undelete (34568) + utilsplugin2 (34506) Last errors/warnings: - W: No configuration settings found. Using hardcoded default values for all pools.
Attachments (3)
Change History (10)
by , 6 years ago
Attachment: | 16942.patch added |
---|
by , 6 years ago
Attachment: | rel7379046.osm.pbf added |
---|
follow-up: 4 comment:1 by , 6 years ago
by , 6 years ago
Attachment: | 16942-v2.patch added |
---|
follow-up: 5 comment:2 by , 6 years ago
I was able to run the unit test via ant.
The first version of the patch did not work with negative ids, it used getId() instead of getUniqueId().
This is really a bad trap. getId() returns 0 if id is negative. I think it would be more intuitive to have a simple getter here.
Probably too late to say that...
comment:4 by , 6 years ago
Cc: | added |
---|
Replying to GerdP:
I tried to run the unit test MultipolygonTestTest in Eclipse but it seems I have to install something new? It complains about JMockit:
@ris: It's a pain to run JUnit tests from Eclipse now... :( How could we improve this?
comment:5 by , 6 years ago
Replying to GerdP:
The first version of the patch did not work with negative ids, it used getId() instead of getUniqueId().
This is really a bad trap. getId() returns 0 if id is negative. I think it would be more intuitive to have a simple getter here.
Probably too late to say that...
Yes, it's here for like.. forever and used everywhere. This the kind of things we expect every developers to know :)
comment:6 by , 6 years ago
Keywords: | performance added |
---|
Performance related things are very appreciated. When I load polygons from the whole country for error correcting it's humping to wait sooo long.
comment:7 by , 6 years ago
Milestone: | → 18.11 |
---|
I tried to run the unit test MultipolygonTestTest in Eclipse but it seems I have to install something new? It complains about JMockit:
java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalStateException: JMockit didn't get initialized; please check the -javaagent JVM initialization parameter was used