To improve startup times of KDE applications, I plan to create an icon cache which would store all icons in a common location. This would eliminate the need to scan tens of directories for icon locations, thus reducing disk seeking. And as the cache would consist of only two files, it would often be wholly cached in the memory by the operating system, eliminating disk access completely. Furthermore, the cache enables loading icons directly from SVGs, using any scale, as the SVGs need to be converted into pixmaps only on the first use. Finally, the cache would make it possible to support simple icon compositing, making it much easier for third-party applications to provide icons which always fit into user's current icon theme.
Author: Rivo Laks
Mentor: Aaron Seigo
Code will be available from KDE's SVN server, under /branches/work/soc-iconcache
The icon cache will consist of two files: one will be index and the other will hold the actual data.
Index will be implemented using AVL- or B-tree
Every entry in the index consists of:
The data file entries have:
Those entries are written directly one after another. As we needn't support deletion of entries, this will be the most simple & fastest way.
To keep the cache's size within reasonable limits, a daemon similar to kio_http_cache_cleaner would periodically check it's size. If the cache is too big, the daemon would rebuild it from scratch, using most recently and frequently used entries until cache's size is 80% or so of the limit. This would avoid having to support on-the-fly deletion of entries and thus make the cache faster. This would
Additionally the daemon can be used to periodically rebuild the cache, arranging it's contents into a more favourable pattern: