Review Request: little faster sycoca
Rolf Eike Beer
kde at opensource.sf-tec.de
Tue Sep 27 22:39:11 BST 2011
Am Dienstag, 27. September 2011, 20:42:54 schrieb Jaime Torres Amate:
> before: 2984 calls to constBegin, 0,00%. 2960531 calls to constEnd, 2.33%
> after: 2921 calls to constBegin, 0,00%. 2921 calls to constEnd, 0.00%
>
> before: calcDiversity, 55.83% (debug enabled)
> after: calcDiversity, 14,46% (debug enabled)
>
> buildsycoca is still not faster than light, but it is only a four lines
> patch.
>From a quick view: looks good.
The trunkcate(sz) isn't needed AFAICT as matrix' size is never changed after
the constructor so it already has this size.
Ok, let's look on some other points:
-the "register" inside the inner if's is superfluous, there is no place a
function result could be stored between two function calls but in a register
-from what I see the first branch iterates through the loop if pos is -1 and
never does anything. -(-1)-1 is 0, and inside the loop it checks "pos != 0".
Since pos can't change inside the loop it should be checked outside the loop
so the whole iterating can be avoided at all. Or it could be merged with the
first line of the function to immediately return 0.
-the remaining register statement now is probably useless, too. The value is
only preserved for very few instructions, so the compiler should already do
this right. Hopefully.
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110927/0b2ae393/attachment.sig>
More information about the kde-core-devel
mailing list