[PATCH] Cache returned KIconLoader pixmaps in 4.5.2

Michael Pyne mpyne at kde.org
Tue Sep 14 03:36:53 BST 2010


On Monday, September 13, 2010 20:37:11 Ingo Klöcker wrote:
> Maybe not, but something like
>   QString("%1_%2_%3").arg(name).arg(size).arg(overlays.join("_"))
> is completely braindead because it's horribly slow.
> 
> What about
>   return ( group == KIconLoader::User ? QLatin1Literal("$kicou_") :
> QLatin1Literal("$kico_") ) % name
>          % QLatin1Char('_')
>          % QString::number(size)
>          % QLatin1Char('_')
>          % overlays.join("_")
>          % ( group >= 0 ? mpEffect.fingerprint(group, state) :
> QString("noeffect") ); ?

I actually didn't know about QStringBuilder, so thanks for introducing me to 
that and the new operator% for QString that it magically enables.

Anyways, your patch reduces execution time in Matthias's benchmark by 8% for 
me, and the makeCacheKey portion of looking up an entry in a warm cache goes 
from 34% of loadIcon to a "mere" 13% so it looks good. I'll go ahead and 
commit tonight, and given there's been no objections to backporting the patch 
I first mailed about, I'll backport that tonight as well.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100913/d6cf3da3/attachment.sig>


More information about the kde-core-devel mailing list