Changeset 35984 in osm for applications/editors


Ignore:
Timestamp:
2022-06-16T23:41:29+02:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #20703: GeographicReader.createOrGetWay is slow due to many Arrays.copyOf (opendata)

This lead to a speedup for loading the simplified-land-polygons-complete-3857.zip
file from ~5.5 minutes to <2 minutes. Allocations in createOrGetWay went from
187 GiB to 3.5 GiB.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java

    r35976 r35984  
    181181        Way tempWay = new Way();
    182182        if (ls != null) {
     183            final List<Node> nodes = new ArrayList<>(ls.getNumPoints());
    183184            // Build list of nodes
    184185            for (int i = 0; i < ls.getNumPoints(); i++) {
    185186                try {
    186                     tempWay.addNode(createOrGetNode(ls.getPointN(i)));
     187                    nodes.add(createOrGetNode(ls.getPointN(i)));
    187188                } catch (TransformException | IllegalArgumentException e) {
    188189                    Logging.error("Exception for " + ls + ": " + e.getClass().getName() + ": " + e.getMessage());
    189190                }
    190191            }
     192            tempWay.setNodes(nodes);
    191193            // Find possible duplicated ways
    192194            if (tempWay.getNodesCount() > 0) {
Note: See TracChangeset for help on using the changeset viewer.