From 2c7b1cf76206541fbebeeb19ab22a928895f1819 Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Mon, 22 Jan 2018 20:15:01 +0100 Subject: [PATCH] From 22% of cpu in hasTransientInternal to 0.2x% Summary: According to callgrind, checking kwin in release with debug symbols, 22% of cpu time in the method hasTransientInternal is spent doing a cast to Client *, while at the begining of the method, the cast to const Client * only uses 1.0x%. Test Plan: The workload was just show 50 messagebox copying small files and being unable to change the permissions. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D9982 --- group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group.cpp b/group.cpp index f39c553fc..a4c4b0a9f 100644 --- a/group.cpp +++ b/group.cpp @@ -726,7 +726,7 @@ bool Client::hasTransientInternal(const Client* cl, bool indirect, ConstClientLi for (auto it = transients().constBegin(); it != transients().constEnd(); ++it) { - Client *c = dynamic_cast(*it); + const Client *c = qobject_cast(*it); if (!c) { continue; }