Opened 3 years ago
Closed 19 months ago
#4161 closed defect (fixed)
[patch] Major slowdown in recent versions
| Reported by: | stoecker | Owned by: | Don-vip |
|---|---|---|---|
| Priority: | major | 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 Changed 3 years ago by jttt
comment:2 Changed 3 years ago by jttt
- Owner changed from team to jttt
comment:3 follow-up: ↓ 4 Changed 3 years ago by jttt
- Resolution set to fixed
- Status changed from new to closed
comment:4 in reply to: ↑ 3 Changed 20 months ago by Don-vip
- Resolution fixed deleted
- Status changed from closed to 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)
Changed 20 months ago by Don-vip
comment:5 Changed 19 months ago by stoecker
- Owner changed from jttt to Don-vip
- Status changed from reopened to new
- Summary changed from Major slowdown in recent versions to [patch] Major slowdown in recent versions
Do you handle this yourself?
comment:6 Changed 19 months ago by Don-vip
Yep, on my way :)
comment:7 Changed 19 months ago by Don-vip
- Resolution set to fixed
- Status changed from new to closed
In [4572/josm]:



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.