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:2 by , 9 years ago
Keywords: | gsoc-core added |
---|---|
Owner: | changed from | to
comment:3 by , 9 years ago
Milestone: | → 16.05 |
---|
comment:4 by , 9 years ago
Milestone: | 16.05 → 16.06 |
---|
comment:5 by , 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
comment:6 by , 9 years ago
Milestone: | 16.06 → 16.07 |
---|
comment:7 by , 8 years ago
Milestone: | 16.07 → 16.08 |
---|
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.