KIconLoader improvements: icon server

Gustavo Pichorim Boiko gustavo.boiko at
Tue Jun 14 14:33:43 BST 2005


There has been a discussion on kde-optimize about KIconLoader improvements. 
I'm working to create an icon server that is used to share icons between 
applications. The original idea and its initial implementation is from Lubos 
The idea is to have a daemon running which publishes icons and stay 
refcounting their usage. When an application requests an icon to KIconLoader, 
it checks for the icon in a cache file which contains just the key and the X 
resource id for the icon. If the icon is there, it creates a pixmap using the 
given resource id (sharing the pixmap in the X server). If the icon is not 
there, it queue the icon to be sent to the server. 

One problem I had (and I want a little help on that) is when using 
KUniqueApplication. When it forks, there is a race condition on the DCOP 
calls (when the KIconLoader is created, it checks for the iconserver to be 
running using a DCOP call). Simply commenting the dc->setPriorityCall(true) 
lines in kuniqueapplication.cpp solved the problem, but I don't think that is 
the best way of doing it, help is appreciated.

I have been playing with it and it is quite stable. I have some results (I 
didn't measure memory usage yet, just time for loading icons) that I want you 
to take a look:

test1: 369 icons (32x32)
w/o disk cache: 3628 ms
cached: 361 ms
iconserver: 74 ms
test2: 222 icons (48x48)
w/o disk cache: 2262 ms
cached: 322 ms
iconserver: 35ms
test3: 774 icons (32x32)
w/o disk cache: 4974 ms
cached: 1170 ms
iconserver: 709 ms

The patch for this icon server is attached.
Please take it a look and give me a feedback about that.

Thanks in advance

 Gustavo Pichorim Boiko
  KDE Developer		Computer Science - UFPR    
  Mandriva Labs		gustavo . boiko @ kdemail . net 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdecore_iconserver.patch
Type: text/x-diff
Size: 70821 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>
-------------- next part --------------
Kde-optimize mailing list
Kde-optimize at

More information about the kde-core-devel mailing list