Bug 112532

Summary: Color picker widget is slow to initialize - does not cache color palette data
Product: LibreOffice Reporter: Gabor Kelemen (allotropia) <kelemeng>
Component: frameworkAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: aron.budea, heiko.tietze, libreoffice, mhitza, serval2412, telesto, tgleero, xiscofauli
Priority: medium Keywords: perf
Version: 6.0.0.0.alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=112730
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 85184    

Description Gabor Kelemen (allotropia) 2017-09-20 17:25:08 UTC
While working on bug#105000 - and sprinkling a few SAL_WARN into SvxUnoConvertResourceStringBuiltIn() of svx/source/unodraw/unoprov.cxx [1] - I noticed that the color picker widget runs this color palette initalization method every time it is instantiated. 
This is problematic if there is a window with more than one of this widget, like Options - LibreOffice - Application colors or Options - Writer - Changes, causing slow reaction from the window and a spike in CPU usage as well.

For each widget instance it seems like the current color palette is being read and processed, but this seems to be unnecessary a bit and might be cacheable for better performance. 

[1] https://opengrok.libreoffice.org/xref/core/svx/source/unodraw/unoprov.cxx#1588
Comment 1 Julien Nabet 2017-09-20 18:43:50 UTC
I agree. It seems we call PaletteManager ctr quite a lot each time we access this.
On the contrary if you change the color of the word with button on standard bar, it creates a new PaletteManager which stays until you close LO.

There's also a pb of memory leaking, see tdf#111894 and new try to fix this: https://gerrit.libreoffice.org/#/c/42494/2
Comment 2 Julien Nabet 2017-09-20 18:44:46 UTC
Telesto: even if you're not a dev, thought you might be interested in this one since it concerns perf/leak
Comment 3 Telesto 2017-09-21 11:17:07 UTC
*** Bug 106588 has been marked as a duplicate of this bug. ***
Comment 4 Aron Budea 2017-11-21 22:31:36 UTC
*** Bug 113983 has been marked as a duplicate of this bug. ***
Comment 5 Aron Budea 2017-12-24 08:53:33 UTC
I have a fix in the works for caching palettes, but it's not going to solve the slowness of initializing many color picker widgets (what isn't related to file reading). Anyway, it's better than nothing, and one of the duplicate tickets can be reopened for the remaining performance issue.
Comment 6 Xisco FaulĂ­ 2018-03-26 18:57:38 UTC
Dear Aron Budea,
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assigned it back to yourself if you're still working on this.
Comment 7 QA Administrators 2019-11-07 03:33:36 UTC Comment hidden (obsolete)
Comment 8 NISZ LibreOffice Team 2020-11-25 16:32:26 UTC
*** Bug 138491 has been marked as a duplicate of this bug. ***
Comment 9 QA Administrators 2022-11-26 03:41:20 UTC Comment hidden (obsolete)
Comment 10 Gabor Kelemen (allotropia) 2022-12-12 11:03:11 UTC
This seems to have been solved recently

Seems to be fast enough in current master:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9b46020c262045aed0beace4708565235c2523cc
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

*** This bug has been marked as a duplicate of bug 152301 ***