Review Request 122109: Cache QMetaMethods that are invoked on hot paths.
Milian Wolff
mail at milianw.de
Sat Jan 17 17:26:25 UTC 2015
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122109/#review74187
-----------------------------------------------------------
Ship it!
src/krecursivefilterproxymodel.cpp
<https://git.reviewboard.kde.org/r/122109/#comment51513>
I'd personally move the indexOfMethod + method call into a static free function and use it here and below to share some code.
QMetaMethod findMethod(const QObject* object, const char* signature)
{
int idx = object->metaObject()->indexOfMethod(signature);
Q_ASSERT(idx != -1);
return object->metaObject()->method(idx);
}
...
static const QMetaMethod method = findMethod(q, "_q_sourceDataChanged(...)");
- Milian Wolff
On Jan. 17, 2015, 5:22 p.m., Volker Krause wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122109/
> -----------------------------------------------------------
>
> (Updated Jan. 17, 2015, 5:22 p.m.)
>
>
> Review request for KDE Frameworks and Milian Wolff.
>
>
> Repository: kitemmodels
>
>
> Description
> -------
>
> QMetaObject::invokeMethod calls QMetaObject::indexForMethod internally,
> which is rather expensive. So look up the method once, and invoke it
> via QMetaMethod directly.
>
>
> Diffs
> -----
>
> src/krecursivefilterproxymodel.cpp 241f2e8e7e610c397bebc6608a64e4f12e570aea
>
> Diff: https://git.reviewboard.kde.org/r/122109/diff/
>
>
> Testing
> -------
>
> Tested and measured with the KRFPM usage in GammaRay, saves about 5% of total application CPU cost according to callgrind.
>
>
> Thanks,
>
> Volker Krause
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150117/4a5b1fd6/attachment.html>
More information about the Kde-frameworks-devel
mailing list