Modify

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:

  1. Download a layer, have the continuous download plug-in option enabled.
  2. Zoom out a bit, so JOSM downloads new surrounding areas.
  3. 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 skyper, 7 years ago

Cc: HarryKane added

comment:2 by Klumbumbus, 7 years ago

Keywords: performance added

comment:3 by gaben, 10 months ago

Cc: gaben added

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.

comment:4 by taylor.smock, 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  
    2828import org.openstreetmap.josm.data.UserIdentityManager;
    2929import org.openstreetmap.josm.data.coor.LatLon;
    3030import org.openstreetmap.josm.data.osm.Changeset;
     31import org.openstreetmap.josm.data.osm.ChangesetCache;
    3132import org.openstreetmap.josm.data.osm.UserInfo;
    3233import org.openstreetmap.josm.data.preferences.IntegerProperty;
    3334import org.openstreetmap.josm.data.projection.Projection;
     
    286287        if (n > 0 && !im.isAnonymous()) {
    287288            final UserInfo userInfo = im.getUserInfo();
    288289            if (userInfo != null) {
    289                 final ChangesetCacheManager ccm = ChangesetCacheManager.getInstance();
     290                final ChangesetCache ccm = ChangesetCache.getInstance();
     291                final List<Changeset> changesets = new ArrayList<>(ccm.getChangesets());
    290292                final int userId = userInfo.getId();
    291293                int found = 0;
    292                 for (int i = 0; i < ccm.getModel().getRowCount() && found < n; i++) {
    293                     Changeset cs = ccm.getModel().getValueAt(i, 0);
     294                for (int i = 0; i < changesets.size() && found < n; i++) {
     295                    Changeset cs = changesets.get(i);
    294296                    if (cs.getUser().getId() == userId && cs.getBounds() != null) {
    295297                        model.addElement(new ChangesetBookmark(cs));
    296298                        found++;

comment:5 by gaben, 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 gaben, 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 taylor.smock, 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.

Last edited 9 months ago by taylor.smock (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to simon04.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.