[PATCH] speedup in KMimeTypeFactory?
Olivier Goffart
ogoffart at kde.org
Sun Oct 19 15:23:31 BST 2008
Le dimanche 19 octobre 2008, Matt Rogers a écrit :
> Hi,
>
> The attached patch makes some changes to the matchFileName function in
> kmimetypefactory.cpp which gets called a lot, especially when browsing
> files in the file manager when trying to open a file.
>
> Depending on how you read the callgrind output, it's either a 5% (incl.
> column) speedup or a 0.5% (self column) speedup. I can't remember which is
> the more important number.
The 'incl' is the most important. The self doesn't matter at all (it's
included in the 'incl' anyway)
I would say that what you have to compare is the 'Incl.' absolute cost divided
by the 'Called'
Caching the indexOf('[') certainly helps.
But changing from the operator[] to startsWith/endsWith is probably slower
(the operator[] is inline and fast, while endsWith do lot of comparison and
don't know that we are comparing only one byte)
I don't know if the static QChar really helps.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081019/9b5d4b57/attachment.sig>
More information about the kde-core-devel
mailing list