[PATCH]: KIconLoader::loadIcon() speed ups

David Faure faure at kde.org
Mon Nov 5 10:56:54 GMT 2007

On Monday 05 November 2007, Aaron J. Seigo wrote:
> it was using QDir::isRelativePath exactly once and that was now accounting for 
> fully 33.46% of execution time. that's because it creaes a QFileInfo which 
> init's a file engine ...... yeah. way too much for a hot path like loadIcon. 
> i figure we don't -really- care if it's an absolute or relative path and we 
> can fudge it by asking if the first character is '/'. 
> i'm going to out on a limb and guess that this breaks on windows. if so, i can 
> wrap it in an ifdef because the win is just way too big to ignore.

Yes I suspect it will break on windows in the case where the user is requested to
choose an icon with KIconDialog and he/she uses the file dialog to select a custom icon
(which will then start with "C:\") -- I think.
I would agree with an #ifdef there, we don't have to suffer for Windows's path braindead-ness :).

Good patch otherwise :-)

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list