Changeset 19271 in josm


Ignore:
Timestamp:
2024-12-18T23:36:23+01:00 (30 hours ago)
Author:
taylor.smock
Message:

Fix a performance issue when working with large datasets

The primary issue is that the collection passed to the resetTiles method is a
filtered collection with no defined size. In order to calculate the size, it must
iterate through the collection which becomes expensive with large datasets.

The fix for this is to remove the dependency on the size of the dataset, and just
look at the number of primitives passed in.

In addition, if the current renderer is not StyledTiledMapRenderer, clear the cache and return.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r19247 r19271  
    12501250
    12511251    private void resetTiles(Collection<? extends IPrimitive> primitives) {
    1252         if (primitives.size() >= this.data.allNonDeletedCompletePrimitives().size() || primitives.size() > 100) {
     1252        // Clear the cache if we aren't using tiles. And return.
     1253        if (!MapRendererFactory.getInstance().isMapRendererActive(StyledTiledMapRenderer.class)) {
     1254            this.cache.clear();
     1255            return;
     1256        }
     1257        // Don't use anything that uses filtered collections. It becomes slow at large datasets.
     1258        if (primitives.size() > 100) {
    12531259            dirtyAll();
    12541260            return;
Note: See TracChangeset for help on using the changeset viewer.