Opened 15 years ago
Closed 13 years ago
#4161 closed defect (fixed)
[patch] Major slowdown in recent versions
Reported by: | stoecker | Owned by: | Don-vip |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
With a medium sized dadaset adding tags or e.g. adding virtual nodes takes very long. Some of the changes in last versions still have problems with larger datasets and these issues are now exposed to the user through normal all-day-operations.
Attachments (1)
Change History (8)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Owner: | changed from | to
---|
follow-up: 4 comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Replying to jttt:
(In [2655]) Fixed #4161 Major slowdown in recent versions, used correct pattern for listeners realized using CopyOnWriteArrayList
I think this fix has still to be improved.
There is a problem in this piece of code from trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListModel.java:
protected void addChangeset(Changeset changeset) { if (shownChangesets.add(changeset)) { setChangesets(shownChangesets); updateModel(); } } protected void removeChangeset(Changeset changeset) { if (shownChangesets.remove(changeset)) { setChangesets(shownChangesets); updateModel(); } } protected void setChangesets(Collection<Changeset> changesets) { shownChangesets.clear(); if (changesets != null) { shownChangesets.addAll(changesets); } updateModel(); } private void updateModel() { Set<Changeset> sel = getSelectedChangesets(); data.clear(); data.addAll(shownChangesets); ChangesetCache cache = ChangesetCache.getInstance(); for (Changeset cs: data) { ... } sort(); fireIntervalAdded(this, 0, getSize()); setSelectedChangesets(sel); }
Each call of addChangeset() and removeChangeset() has for sole effect to clear the collections shownChangesets and data ! In fact, these collections are only managed via the setChangeset() method.
These useless methods are however called very often (at least at every primitive creation in edit layer) and may increase memory footprint for nothing.
Are you ok to delete them ? (see attached patch)
by , 13 years ago
Attachment: | new_patch.diff added |
---|
comment:5 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
Summary: | Major slowdown in recent versions → [patch] Major slowdown in recent versions |
Do you handle this yourself?
This is caused by ChangesetsInActiveDataLayerListModel that updates list of changeset after every change in dataset (even when changset dialog is not shown). Best would be if the model used DatasetEventManager to register for current dataset events and update only what is necessary. Also ToggleDialog.showNotify and hideNotify methods should be used to register to listeners only when dialog is visible.
Problem is that change of changesetId doesn't generate dataset event yet.
I'll fix it on weekend if nobody gets time for that sooner.