Map repaint and selection slow with large datasets
|Reported by:||singularita@…||Owned by:||team|
I loaded http://download.geofabrik.de/osm/europe/slovakia.osm.bz2 (~ 160 MB uncompressed) into JOSM. The initial draw took about 7 seconds (no surprise, since entire country is drawn), but once I zoom close enough to see only about 10 or 20 ways and perhaps 50 nodes, every repaint still takes about 1500 msec. When I switched from mappaint to wireframe view, it was even worse (about 2400 msec to repaint)
Redraw of same area, but from smaller dataset (dataset created from the one above by extracting only ways/nodes visible in that view) needs only about 5 msec.
MapPaintVisitor and SimplePaintVisitor seem to iterate though all ways, nodes and relations to find out what to draw. This is very ineffective.
When I click or drag anywhere in the large dataset to select something, the code needs 1000 msec to discover what it was, which is very slow. I discovered that SelectionManager.getObjectsInRectangle iterates through all primitives too.
I think some spatial index (kd-tree, or R-tree could fix the problem) should be added, so larger datasets could be also editable.