Ignore:
Timestamp:
2023-08-07T21:10:16+02:00 (9 months ago)
Author:
taylor.smock
Message:

Fix #23085: Improve speed of selecting large amounts of objects

  • JVM CPU usage was down ~50%, EDT CPU usage was down ~25%. EDT memory usage was down
  • Avoid Stream allocations in ConflictCollection.hasConflictForMy by only looking for a conflict if conflicts exist
  • Avoid many string instantiations in DefaultNameFormatter by using cached properties. This significantly reduces memory allocations CPU usage for DefaultNameFormatter methods.
  • Avoid some Stream allocations by using standard for loops in DefaultNameFormatter
  • Use "" to get the component in PrimitiveRenderer.getListCellRendererComponent -- this reduced the memory allocations by ~50% and CPU usage by ~70% for getListCellRendererComponent by itself, and appears to have no side-effects. We should ask users on different systems with different UI systems if it works properly.
  • Significantly reduce cost of Way.hasOnlyLocatableNodes by using a standard for loop instead of a stream -- this isn't as important for this ticket, but was found while profiling. This makes that method have no effective memory allocations and reduces the CPU usage by ~90%.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java

    r18014 r18794  
    146146     */
    147147    public Conflict<?> getConflictForMy(OsmPrimitive my) {
     148        if (conflicts.isEmpty()) {
     149            return null;
     150        }
    148151        return conflicts.stream()
    149152                .filter(c -> c.isMatchingMy(my))
     
    161164     */
    162165    public Conflict<?> getConflictForTheir(OsmPrimitive their) {
     166        if (conflicts.isEmpty()) {
     167            return null;
     168        }
    163169        return conflicts.stream()
    164170                .filter(c -> c.isMatchingTheir(their))
Note: See TracChangeset for help on using the changeset viewer.