Index: trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 14237)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 14238)
@@ -7,5 +7,4 @@
 import java.util.Locale;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 
@@ -165,6 +164,10 @@
      */
     public static boolean isOsmCollectionEditable(Collection<? extends IPrimitive> collection) {
-        return collection != null && !collection.isEmpty()
-            && collection.stream().map(IPrimitive::getDataSet).filter(Objects::nonNull).noneMatch(OsmData::isLocked);
+        if (collection == null || collection.isEmpty()) {
+            return false;
+        }
+        // see #16510: optimization: only consider the first primitive, as collection always refer to the same dataset
+        OsmData<?, ?, ?, ?> ds = collection.iterator().next().getDataSet();
+        return ds == null || !ds.isLocked();
     }
 }
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 14237)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 14238)
@@ -34,4 +34,5 @@
 import java.util.Base64;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -270,4 +271,7 @@
     }
 
+    /** small cache of critical images used in many parts of the application */
+    private static final Map<OsmPrimitiveType, ImageIcon> osmPrimitiveTypeCache = Collections.synchronizedMap(new HashMap<>());
+
     /** directories in which images are searched */
     protected Collection<String> dirs;
@@ -1474,5 +1478,5 @@
     public static ImageIcon get(OsmPrimitiveType type) {
         CheckParameterUtil.ensureParameterNotNull(type, "type");
-        return get("data", type.getAPIName());
+        return osmPrimitiveTypeCache.computeIfAbsent(type, t -> get("data", t.getAPIName()));
     }
 
