Skip to content

Commit b9add7c

Browse files
author
taylor.smock
committed
Replace most calls for getNodes in VectorWay with direct calls to underlying list
This is primarily to avoid new unmodifiable collection instantiations where we don't need a copy of the list. This significantly reduces the cost of the post-processing merge ways step. Specifically, there is a 55% drop in the memory cost, and 90% fewer CPU cycles. git-svn-id: https://josm.openstreetmap.de/svn/trunk@19107 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent f358f64 commit b9add7c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/org/openstreetmap/josm/data/vector/VectorWay.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public BBox getBBox() {
5656

5757
@Override
5858
public int getNodesCount() {
59-
return this.getNodes().size();
59+
return this.nodes.size();
6060
}
6161

6262
@Override
6363
public VectorNode getNode(int index) {
64-
return this.getNodes().get(index);
64+
return this.nodes.get(index);
6565
}
6666

6767
@Override
@@ -82,12 +82,12 @@ public void setNodes(List<VectorNode> nodes) {
8282

8383
@Override
8484
public List<Long> getNodeIds() {
85-
return this.getNodes().stream().map(VectorNode::getId).collect(Collectors.toList());
85+
return this.nodes.stream().map(VectorNode::getId).collect(Collectors.toList());
8686
}
8787

8888
@Override
8989
public long getNodeId(int idx) {
90-
return this.getNodes().get(idx).getId();
90+
return this.nodes.get(idx).getId();
9191
}
9292

9393
@Override

0 commit comments

Comments
 (0)