Opened 7 years ago
Last modified 9 months ago
#14018 new defect
JOSM is very slow
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | performance | Cc: | HarryKane, gaben |
Description
As reported by HarryKane at ticket:13767#comment:6
I tried again in latest JOSM 11223, but the problem is still there.
Steps to reproduce:
- Download a layer, have the continuous download plug-in option enabled.
- Zoom out a bit, so JOSM downloads new surrounding areas.
- Click the download button again to specify a new area.
You might ask why one does step 3. The reason is that either
a) the download of step 2 takes too long so the user wants to speed up this process by searching the new area (especially when GPS tracks are downloaded) or
b) the user wants to download another area.
In all these cases JOSM is very slow on reacting to the users input and thus hampers the workflow.
Attachments (0)
Change History (7)
comment:1 by , 7 years ago
Cc: | added |
---|
comment:2 by , 7 years ago
Keywords: | performance added |
---|
comment:3 by , 10 months ago
Cc: | added |
---|
comment:4 by , 9 months ago
Have some profiling information:
DownloadDialog.<init>
takes 730ms to 1120ms (two profiling runs). I'll use the 730ms run for further numbers. A good chunk was from plugins. I'll see if I can fix those separately. I'll be using that 730ms run as the "base" for now.
BookmarkList.load
was the primary problem child (200ms), since it also called ChangesetCacheManager.getInstance
. I think we can reduce that significantly with a (relatively) small patch.
-
src/org/openstreetmap/josm/gui/download/BookmarkList.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/download/BookmarkList.java b/src/org/openstreetmap/josm/gui/download/BookmarkList.java
a b 28 28 import org.openstreetmap.josm.data.UserIdentityManager; 29 29 import org.openstreetmap.josm.data.coor.LatLon; 30 30 import org.openstreetmap.josm.data.osm.Changeset; 31 import org.openstreetmap.josm.data.osm.ChangesetCache; 31 32 import org.openstreetmap.josm.data.osm.UserInfo; 32 33 import org.openstreetmap.josm.data.preferences.IntegerProperty; 33 34 import org.openstreetmap.josm.data.projection.Projection; … … 286 287 if (n > 0 && !im.isAnonymous()) { 287 288 final UserInfo userInfo = im.getUserInfo(); 288 289 if (userInfo != null) { 289 final ChangesetCacheManager ccm = ChangesetCacheManager.getInstance(); 290 final ChangesetCache ccm = ChangesetCache.getInstance(); 291 final List<Changeset> changesets = new ArrayList<>(ccm.getChangesets()); 290 292 final int userId = userInfo.getId(); 291 293 int found = 0; 292 for (int i = 0; i < c cm.getModel().getRowCount() && found < n; i++) {293 Changeset cs = c cm.getModel().getValueAt(i, 0);294 for (int i = 0; i < changesets.size() && found < n; i++) { 295 Changeset cs = changesets.get(i); 294 296 if (cs.getUser().getId() == userId && cs.getBounds() != null) { 295 297 model.addElement(new ChangesetBookmark(cs)); 296 298 found++;
comment:5 by , 9 months ago
I cannot reproduce, happens very rarely.
Usually it takes less than a second, but sometimes even half a minute, so this 730-1120ms is within measure error, I would say.
comment:6 by , 9 months ago
Wait a second, the wikipedia plugin adds a new tab to the download dialog for Sophox, can it change the situation?
comment:7 by , 9 months ago
That makes it hard to fix.
If you can attach a profiler next time that happens, that would be helpful.
If you have IntelliJ IDEA Ultimate, you can attach directly to the process. Otherwise, read the docs for https://github.com/async-profiler/async-profiler (hopefully you aren't on Windows). Or look into Java Flight Recorder.
Yes, the Wikipedia plugin could be changing things. Let me check.
I'm looking at making a PR for svgSalamander that will significantly reduce memory allocations as well.
EDIT: I didn't see anything from wikipedia. I'll have to run a check with all the plugins enabled.
Yeah, after clicking on the download button sometimes takes a few seconds for JOSM to respond.
I don't know if it's related to the continuous download plugin, as I'm using it since the beginning.