SvgRectsCache: do not query elements twice
I was looking into why there is so much time spent here for the logout greeter that only has buttons. It seems like we were querying the cache file every time even though we already have separate code that checks whether our information is valid. As I started looking into it, ::loadImageFromCache was %25 of the CPU time. After this patch it's short of 1%.
This commit is contained in:
parent
44a8e6c1ee
commit
b0f8bff4ca
@ -217,15 +217,18 @@ void SvgRectsCache::loadImageFromCache(const QString &path, uint lastModified)
|
||||
return;
|
||||
}
|
||||
|
||||
auto list = imageGroup.readEntry("Invalidelements", QList<unsigned int>());
|
||||
m_invalidElements[path] = QSet<unsigned int>(list.begin(), list.end());
|
||||
auto &elements = m_invalidElements[path];
|
||||
if (elements.isEmpty()) {
|
||||
auto list = imageGroup.readEntry("Invalidelements", QList<unsigned int>());
|
||||
m_invalidElements[path] = QSet<unsigned int>(list.begin(), list.end());
|
||||
|
||||
for (const auto &key : imageGroup.keyList()) {
|
||||
bool ok = false;
|
||||
uint keyUInt = key.toUInt(&ok);
|
||||
if (ok) {
|
||||
const QRectF rect = imageGroup.readEntry(key, QRectF());
|
||||
m_localRectCache.insert(keyUInt, rect);
|
||||
for (const auto &key : imageGroup.keyList()) {
|
||||
bool ok = false;
|
||||
uint keyUInt = key.toUInt(&ok);
|
||||
if (ok) {
|
||||
const QRectF rect = imageGroup.readEntry(key, QRectF());
|
||||
m_localRectCache.insert(keyUInt, rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user