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

List:       kde-frameworks-devel
Subject:    Re: QIcon::fromTheme(xxx, someFallback)
From:       David Faure <faure () kde ! org>
Date:       2015-09-08 8:26:20
Message-ID: 9387102.06fc9clpo1 () asterix
[Download RAW message or body]

On Monday 07 September 2015 15:53:31 Olivier Goffart wrote:
> 
> But the problem is that QIcon::isNull is likely to be called anyway.
> And this will again do all the look ups in the file system.
 
I don't think so. That's the whole reasoning behind this change.

I added debug output in QIcon and ran konqueror-kf5 (details below).

Result: QIcon::fromTheme is called 84 times, for 66 different icon names.
Among those, 56 do NOT lead to an isNull call.

I think for icons for QActions in menus aren't loaded (or even checked with
isNull) until opening the menu. So this really helps speeding up application startup.

On the other hand, isNull() can obviously be called multiple times for
a given icon, so of course we shouldn't make it slower, it should have the
answer at hand immediately.

==== Tracing details ====

Qt patch http://www.davidfaure.fr/2015/qicon.cpp.diff

$ konqueror 2>&1 | tee /k/konq5-icon.txt

sample output:
konqueror(28364)/default QIcon::fromTheme: QIcon::fromTheme "konqueror" 0x117dc80
konqueror(28364)/default QIcon::fromTheme: QIcon::fromTheme \
"edit-clear-locationbar-rtl" 0x1372830 konqueror(28364)/default QIcon::fromTheme: \
QIcon::fromTheme "document-print-frame" 0x136af50 konqueror(28364)/default \
QIcon::isNull: QIcon::isNull "" 0x0 konqueror(28364)/default QIcon::isNull: \
QIcon::isNull "konqueror" 0x117dc80 (some lines being repeated more than once)

$ grep fromTheme /k/konq5-icon.txt | sort | uniq | wc -l
66

$ grep fromTheme /k/konq5-icon.txt | sed -e 's/.*0x//' | sort | uniq | while read a; \
do grep $a /k/konq5-icon.txt | grep -q isNull || echo $a ; done | wc -l 56

-- 
David Faure, faure@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


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

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