broulik created this revision. broulik added a reviewer: Plasma. broulik set the repository for this revision to R242 Plasma Framework (Library). Restricted Application added projects: Plasma, Frameworks. Restricted Application added subscribers: Frameworks, plasma-devel.
REVISION SUMMARY Plasma spends roughly 0.5ms per applet just compiling this component (QQmlComponent creation), so cache it away. All applets did share the same QQmlEngine here but I don't think this can be trusted, hence store the components in a QHash per engine. While at it, turn the Item into a QtObject to reduce overhead since we just want the Component.onCompleted to be executed and that's it. Before: 41 calls (18ms in total) After: 41 calls (1.9ms in total) TEST PLAN Verified that a QtQuick Controls 1 Button still uses the Plasma theme. The QObject::destroyed I use to remove the component from the hash again is never executed, even on kquitapp plasmashell. REPOSITORY R242 Plasma Framework (Library) REVISION DETAIL https://phabricator.kde.org/D4362 AFFECTED FILES src/plasmaquick/appletquickitem.cpp src/plasmaquick/private/appletquickitem_p.h EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: broulik, #plasma Cc: plasma-devel, #frameworks, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas