[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/icons
From:       Michael Pyne <mpyne () kde ! org>
Date:       2010-05-29 2:54:45
Message-ID: 20100529025445.11498AC8C2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1131792 by mpyne:

Do not allow duplicate paths in the icon search path for KIconTheme. This
change reduces the search path on my system using the default theme from 105 to
76 entries.

A completely unscientific test opening Dolphin on /usr/bin with previews
enabled and closing as soon as the view was drawn showed only a minor
improvement (about 14.6 seconds to 13.2 seconds).

However I've also seen "regressions" in performance because my test is also
highly affected by kernel caching, KSharedDataCache performance, etc so your
mileage may vary.


 M  +4 -1      kicontheme.cpp  


--- trunk/KDE/kdelibs/kdeui/icons/kicontheme.cpp #1131791:1131792
@@ -133,6 +133,7 @@
     QStringList::ConstIterator it, itDir;
     QStringList themeDirs;
     QString cDir;
+    QMap<QString, bool> addedDirs; // Used for avoiding duplicates.
 
     // Applications can have local additions to the global "locolor" and
     // "hicolor" icon themes. For these, the _global_ theme description
@@ -204,7 +205,9 @@
     for (it=dirs.begin(); it!=dirs.end(); ++it) {
         KConfigGroup cg(d->sharedConfig, *it);
         for (itDir=themeDirs.constBegin(); itDir!=themeDirs.constEnd(); ++itDir) {
-            if (KStandardDirs::exists(*itDir + *it + '/')) {
+            const QString currentDir(*itDir + *it + '/');
+            if (KStandardDirs::exists(currentDir) && !addedDirs.contains(currentDir)) {
+                addedDirs.insert(currentDir, true);
                 KIconThemeDir *dir = new KIconThemeDir(*itDir, *it, cg);
                 if (!dir->isValid()) {
                     delete dir;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic