Modify

Opened 9 years ago

Closed 8 years ago

#12767 closed defect (fixed)

PaintColors#get() is slow.

Reported by: michael2402 Owned by: michael2402
Priority: minor Milestone: 16.08
Component: Core mappaint Version:
Keywords: gsoc-core Cc:

Description

Currently, PaintColors#get() does the following for each request:

  • call Preferences#getColor()
  • Convert the human readable text to a peference friendly string
  • Add that string to the colornames table
  • Convert the default color to HTML representation
  • Do the preference lookup
  • Convert back to a Color object.

The main problem with this is that AreaElement#create() (calls it whenever text-position is null) and LineTextElement#create() are calling this pretty often.

I suggest adding a cache to the PaintColors, ConflictColors, Severity (and probably other) classes. This would also fix Severity class (colors not reloaded on preference change).

Attachments (0)

Change History (8)

comment:1 by bastiK, 9 years ago

Good point, I agree it should be cached.

Btw., we have plots to show the drawing performance over time and possible improvement or regression: example, others here. Unfortunately the measurement on the server is not as stable as I had hoped it would be.

Last edited 9 years ago by bastiK (previous) (diff)

comment:2 by michael2402, 9 years ago

Keywords: gsoc-core added
Owner: changed from team to michael2402

comment:3 by Don-vip, 9 years ago

Milestone: 16.05

comment:4 by michael2402, 9 years ago

Milestone: 16.0516.06

comment:5 by michael2402, 9 years ago

I started some work on this.

This is what I do to provide a universal solution:

  • Remove color code from preferences, move it to ColorPreference/IntegerPreference/...
  • Allow listeners to be added to a single property
  • Add a new String<->Object conversion abstraction (AbstractToStringProperty) that makes preference code cleaner
  • Add a caching proxy for the property value

Current status (low priority):
https://github.com/michaelzangl/josm/commits/preferences-listenable

Last edited 9 years ago by michael2402 (previous) (diff)

comment:6 by michael2402, 9 years ago

Milestone: 16.0616.07

comment:7 by Don-vip, 8 years ago

Milestone: 16.0716.08

comment:8 by michael2402, 8 years ago

Resolution: fixed
Status: newclosed

Fixed, see #13309

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain michael2402.
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.