[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request: Analog clock painting performance
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2008-11-30 23:53:22
Message-ID: 200811301653.28463.aseigo () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
On Sunday 30 November 2008, you wrote:
> > On 2008-11-30 09:01:20, Aaron Seigo wrote:
> > > hm. that seems a little suspect to me, but if grabbing the cached rects
> > > is really that slow, then Theme::findInRectsCache is probably what
> > > needs to be optimized.
> > >
> > > can you post the cachegrind output somewhere, along with the clock
> > > configuration you used?
>
> It's not that it is very slow, it's that it was called 13 times for each
> update. Quite a bit of overhead when you have the m_fancyHands enabled!
>
> http://aboyer.dyndns.org/kde/callgrind.out.before
> http://aboyer.dyndns.org/kde/callgrind.out.after
hm .. indeed .. does the attached patch help with this? if so, this would get
us this optimization for all uses of Plasma::Svg at the cost of a little extra
memory overhead.
looking at the callgrind output it looks like that the key is to try and avoid
hitting KConfigGroup::readEntry.
> >From the comments below, I guess the moral of the story is not to assume
> > that the elements are properly positioned in the svg file. These changes
> > now become pretty useless. I'll try to reduce the amount of actual
> > painting instead of caching the rects.
yeah, trying to reduce the painting will be the big win.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Qt Software
["localSvgRectCache.diff" (text/x-patch)]
Index: svg.cpp
===================================================================
--- svg.cpp (revision 890270)
+++ svg.cpp (working copy)
@@ -233,19 +233,25 @@
}
renderer = 0;
+ localRectCache.clear();
}
QRectF elementRect(const QString &elementId)
{
- QRectF rect;
-
if (themed && path.isEmpty()) {
path = Plasma::Theme::defaultTheme()->imagePath(themePath);
}
- bool found = Theme::defaultTheme()->findInRectsCache(path, cacheId(elementId), rect);
+ QString id = cacheId(elementId);
+ if (localRectCache.contains(id)) {
+ return localRectCache[id];
+ }
+ QRectF rect;
+ bool found = Theme::defaultTheme()->findInRectsCache(path, id, rect);
+
if (found) {
+ localRectCache.insert(elementId, rect);
return rect;
}
@@ -332,6 +338,7 @@
Svg *q;
static QHash<QString, SharedSvgRenderer::Ptr> s_renderers;
+ QHash<QString, QRectF> localRectCache;
SharedSvgRenderer::Ptr renderer;
QString themePath;
QString path;
@@ -484,10 +491,9 @@
void Svg::setImagePath(const QString &svgFilePath)
{
- if (d->setImagePath(svgFilePath, this)) {
- }
- d->eraseRenderer();
- emit repaintNeeded();
+ d->setImagePath(svgFilePath, this);
+ d->eraseRenderer();
+ emit repaintNeeded();
}
QString Svg::imagePath() const
["signature.asc" (application/pgp-signature)]
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic