﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
16942	[Patch] Poor performance in validator hang when checking complex Multipolygon	GerdP	team	"==== What steps will reproduce the problem?
1. Download relation 7379046 (attached as sample file)
2. 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.
}}}
"	enhancement	closed	normal	18.11	Core validator		fixed	template_report performance	ris
