Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22529 closed enhancement (fixed)

[Patch] possibly improve performance in class `ChangesetDataSet`

Reported by: GerdP Owned by: team
Priority: normal Milestone: 22.12
Component: Core Version:
Keywords: performance Cc:

Description

When reading changesets, JOSM repeatedly may call method getPrimitiveId() for the same object in ChangesetDataSet.put() which is called when a changeset is read. Unless the run time optimizer can kick in this method creates a new SimplePrimitiveId instance each time it is called. The patch creates a single instance and uses map.computeIfAbsent() as recommended by sonarlint.

Attachments (1)

cs-perf.patch (2.2 KB ) - added by GerdP 3 years ago.

Download all attachments as: .zip

Change History (10)

by GerdP, 3 years ago

Attachment: cs-perf.patch added

comment:1 by taylor.smock, 3 years ago

Milestone: 22.12

Thanks for profiling this. :)

It looks like SimplePrimitiveId could be a value/record class. Unfortunately, we aren't on Java 14+ yet. And I'd have to check for binary compatibility problems with plugins.

Anyway, it looks good to me.

comment:2 by GerdP, 3 years ago

Resolution: fixed
Status: newclosed

In 18606/josm:

fix #22529: possibly improve performance in class ChangesetDataSet

  • avoid repeated calls of getPrimitiveId() which creates instances of SimplePrimitiveId
  • use map.computeIfAbsent() as recommended by sonarlint

comment:3 by GerdP, 3 years ago

Oops, sorry, did not see that the milestone is one off. Revert?

comment:4 by taylor.smock, 3 years ago

No. I had been intending to do a release this week, then I started getting bug reports for something I changed three weeks ago.

comment:5 by GerdP, 3 years ago

Maybe like the one in #22538?

comment:6 by taylor.smock, 3 years ago

Milestone: 22.1222.11

Yep, I fixed that in r18605, and now people are coming out of the woodwork with feedback. Which is the whole reason why I did the modification three weeks ago -- so people would have time to give feedback before the 22.11 release.

See #21605 for the discussion on the patch.

comment:7 by skyper, 3 years ago

@Taylor:
Thanks for your work. Please, do not be too disappointed as time is relative. At least we got around a hotfix so far. One question would be how to get more people to use latest.

comment:8 by taylor.smock, 3 years ago

We could try changing the bug report window to say something along the lines of Please consider running josm-latest(link) so we can avoid bugs in josm-tested.

Or maybe, in the wiki:StartupPage, we can have a running list of upcoming changes for feedback.

So

Upcoming changes (in JOSM latest, next release {planned [date]|postponed due to bug reports to [date]})

  • Add tabs to the ImageViewer (see #21605, feedback would be appreciated)
  • OAuth 2 support (expert mode only until July 2023)

comment:9 by taylor.smock, 3 years ago

Milestone: 22.1122.12

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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