Changeset 18502 in josm
- Timestamp:
- 2022-06-27T18:29:34+02:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r17744 r18502 8 8 import java.util.Objects; 9 9 import java.util.Optional; 10 import java.util.stream.IntStream;11 10 12 11 import org.openstreetmap.josm.data.osm.INode; … … 351 350 } 352 351 353 private static int max(int... elements) { 354 return IntStream.of(elements).max().orElseThrow(IllegalStateException::new); 352 private static int max(int a, int b, int c, int d) { 353 // Profile before switching to a stream/int[] array 354 // This was 66% give or take for painting nodes in terms of memory allocations 355 // and was ~17% of the CPU allocations. By not using a vararg method call, we avoid 356 // the creation of an array. By avoiding both streams and arrays, the cost for this method is negligible. 357 // This means that this saves about 7% of the CPU cycles during map paint, and about 20% 358 // of the memory allocations during map paint. 359 return Math.max(a, Math.max(b, Math.max(c, d))); 355 360 } 356 361
Note:
See TracChangeset
for help on using the changeset viewer.