From d38be811e82ba1a7dd96d0cfea4cf5b862edff63 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 30 Jan 2017 15:08:09 +0100 Subject: [PATCH] [FrameData] Avoid iterating keys() Instead use iterators. Could be changed to using keyBegin or something like that potentially. The destructor is called 400 times on plasmashell startup for me. Before: 250,000ns After: 110,000ns Differential Revision: https://phabricator.kde.org/D4350 --- src/plasma/framesvg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plasma/framesvg.cpp b/src/plasma/framesvg.cpp index a50a829d3..f75252835 100644 --- a/src/plasma/framesvg.cpp +++ b/src/plasma/framesvg.cpp @@ -48,8 +48,8 @@ static const int MAX_FRAME_SIZE = 100000; FrameData::~FrameData() { - foreach (FrameSvg *frame, references.keys()) { - frame->d->frames.remove(prefix); + for (auto it = references.constBegin(), end = references.constEnd(); it != end; ++it) { + it.key()->d->frames.remove(prefix); } }