Changes between Version 1 and Version 2 of Ticket #22139


Ignore:
Timestamp:
2022-06-14T23:11:28+02:00 (4 years ago)
Author:
taylor.smock
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22139

    • Property Summary [PATCH] Significantly reduce allocations in NodeElement and StyledMapRenderer[PATCH] Significantly reduce allocations in NodeElement
  • Ticket #22139 – Description

    v1 v2  
    11{{{#!diff
    2 diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
    3 index b27acb4bc5..2e49c30ca5 100644
    4 --- a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
    5 +++ b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
    6 @@ -52,6 +52,7 @@ import org.openstreetmap.josm.data.osm.IPrimitive;
    7  import org.openstreetmap.josm.data.osm.IRelation;
    8  import org.openstreetmap.josm.data.osm.IRelationMember;
    9  import org.openstreetmap.josm.data.osm.IWay;
    10 +import org.openstreetmap.josm.data.osm.Node;
    11  import org.openstreetmap.josm.data.osm.OsmData;
    12  import org.openstreetmap.josm.data.osm.OsmPrimitive;
    13  import org.openstreetmap.josm.data.osm.OsmUtils;
    14 @@ -754,7 +755,9 @@ public class StyledMapRenderer extends AbstractMapRenderer {
    15          if (size <= 0 && !n.isHighlighted())
    16              return;
    17  
    18 -        MapViewPoint p = mapState.getPointFor(n);
    19 +        // This reduces memory usage for StyledMapRenderer#paintWithLock from 5.1% to 1.2%
    20 +        // and slightly reduces CPU usage.
    21 +        MapViewPoint p = n instanceof Node ? mapState.getPointFor((Node) n) : mapState.getPointFor(n);
    22  
    23          if (n.isHighlighted()) {
    24              drawPointHighlight(p.getInView(), size);
    252diff --git a/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java b/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
    263index 69b05c84b6..2b6852d7ba 100644