From 1f2a372fd840d56b545971bfc9b0610c3ce61ea5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 13 Feb 2017 19:08:46 +0100 Subject: [PATCH] TaskManager: add icon to cache after painfully querying it over XCB/NETWM. Summary: Hitting again a bug where switching desktops shows a delay of several seconds before the taskbar updates, I noticed that this code path was called 81 times in 7 seconds (!) for kmail (maybe because I start it from cmdline rather than via a .desktop file). After the 4 slow calls to KWindowSystem::icon it seems definitely worth it to cache the result. Overall the main performance bug is still there though, switching desktops is still slow, but now all backtraces show QML triggered by model/view dataChanged signals, no idea yet, other than hoping for the pending QSFPM patches to help with this (no need to re-sort when the dataChanged roles are unrelated to the roles used for sorting). Reviewers: hein Reviewed By: hein Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4600 --- libtaskmanager/xwindowtasksmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp index ad0bdf600..aa56ef429 100644 --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -471,6 +471,8 @@ QIcon XWindowTasksModel::Private::icon(WId window) icon.addPixmap(KWindowSystem::icon(window, KIconLoader::SizeMedium, KIconLoader::SizeMedium, false)); icon.addPixmap(KWindowSystem::icon(window, KIconLoader::SizeLarge, KIconLoader::SizeLarge, false)); + appDataCache[window].icon = icon; + return icon; }