KIconLoader: reduce number of lookups when doing fallbacks
Review Request #128514 - Created July 24, 2016 and submitted
In the first pass, we already checked whether the icon exists in all icon themes. So in the second pass, there's no point in starting with that again, we can go ahead and start doing fallbacks right away. (The comment about the two passes was removed in b84858c, but some of it still applies.) Tested with: strace -e file ./kiconengine_unittest testUnknownIconNotCached |& wc -l Before: 6341 After: 4589
strace as mentionned above.
All unittests still pass (incl fallback lookups, didn't check how complete those were, though)
|This is not correct. When you have genericFallback && !currentName.empty() you never reach line 1071 to get an icon. So ...||Anthony Fieroni|
This is not correct. When you have genericFallback && !currentName.empty() you never reach line 1071 to get an icon. So your code returns an empty path for non empty currentName in genericFallback. If this can be expected, i'm not familliar with path expectations, you can make exclusive check before 2 loops, i.e. before foreach.
Improve comment, to mention the long term solution for this (this is really the wrong layer for this fallback code...) ; add early-return case to clarify what happens when looking up video-x-generic in the first place.
Revision 2 (+48 -6)