KIconLoader Optimization Idea

Simon Hausmann hausmann at kde.org
Tue Jun 7 08:11:04 CEST 2005


On Monday 06 June 2005 18:15, Alexander Neundorf wrote:
> On Sunday 05 June 2005 15:45, Luke Alan Sandell wrote:
> > Hi, my name is Luke Sandell, and I am a student at Appalachian State
> > University looking for a project to do for Google's Summer of Coding. I
> > had an idea for optimization but I wanted to run it by this group before
> > I decide.
> >
> > My idea deals with the never-ending saga of application startup times.
> > From
>
> ...
>
> > What do you think? If this is not a good idea, feel free to suggest
> > others.
>
> the topic of improving icon loading has been discussed already several
> times. Using an icon server and sockets or pipes to communicate with it and
> transfer the icons through them will be slower than just reading the files
> from disk. Shared memory is probably faster, nevertheless you have to talk
> to the server so that it can actually load the icon. And you have to make
> sure that everything stays consistent, that the apps don't crash if the
> iconserver crashed, race conditions etc.
> It's not sure that this will improve performance.
>
> A lot of time is also spent by just searching the icon.
>
> Maybe a binary archive of all/many/most used icons which is autogenerated
> when icons are installed and which can be mmaped might be another idea
> (like ksycoca). Disk space is cheap, maybe they could even be cached
> uncompressed.

Lars had the idea of using Qt4's resource system for that. For the common 
icons compile them into a binary blob using rcc, mmap it and register it at 
the resource system as if it were a regular resource. Then you can 
transparently access the mmap'ed icons using QFile[1], and if constructed 
using the QPixmap constructor that takes a filename (or use load()) you get 
the cache for pixmaps on the x-server for free.

Simon

[1] For example: QFile f(":/kde/icons/common/filenew.png");
    or ready for use and combined with the cache: 
    QPixmap pixmap(":/kde/icons/common/back.png");


More information about the Kde-optimize mailing list