<table><tr><td style="">broulik updated this revision to Diff 23315.<br />broulik retitled this revision from "RFC: [AppletQuickItem] Cache QQmlComponent used for settings QtQuick Controls 1 style" to "[AppletQuickItem] Only set QtQuick Controls 1 style once per engine".<br />broulik edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-ueayeyripw3hweb/" rel="noreferrer">(Show Details)</a><br />broulik edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-kzchrwrlv376ntj/" rel="noreferrer">(Show Details)</a>
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4362" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Plasma spends roughly 0.5ms per applet just compiling this component (QQmlComponent creation), so cache it away.<br />
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.<br />
While at it</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">The style is global per engine</span>, t<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">urn the Item into a QtObject to reduce overhead since we just want the Component.onCompleted to be executed and that's it.<br />
<br />
Before: 41 calls (18ms in total)</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">here's no need to set it for every applet created as the engines are shared.</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">After: 41 calls (1.9ms in total)<br />
</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Since this entire thing is just a hack, just setting a dynamic property to identify that we've set a style is valid imho.</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;">Verified that a QtQuick Controls 1 Button still uses the Plasma theme.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">The QObject::destroyed I use to remove the component from the hash again is never executed, even on kquitapp plasmashell</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Saves like 16 ms for me</span>.</div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R242 Plasma Framework (Library)</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D4362?vs=10755&id=23315" rel="noreferrer">https://phabricator.kde.org/D4362?vs=10755&id=23315</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4362" rel="noreferrer">https://phabricator.kde.org/D4362</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/plasmaquick/appletquickitem.cpp</div></div></div><br /><div><strong>To: </strong>broulik, Plasma<br /><strong>Cc: </strong>mart, davidedmundson, plasma-devel, Frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol<br /></div>